From 04a1c87d18b0b15d9cf4af825624cf1a00f2c791 Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Sun, 30 Jul 2023 19:12:47 +0300 Subject: [PATCH 1/3] Add coverage target This is a easy way to run: go tool cover -html=cover.out The reported coverage depends on running one of the test targets (e.g. make test). Signed-off-by: Nir Soffer --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 16a19f90a..6aa367cf6 100644 --- a/Makefile +++ b/Makefile @@ -172,6 +172,9 @@ test-drcluster: generate manifests envtest test-util-pvc: generate manifests envtest KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) go test ./controllers/util -coverprofile cover.out $(GO_TEST_GINKGO_ARGS) -ginkgo.focus PVCS_Util +coverage: + go tool cover -html=cover.out + .PHONY: venv venv: hack/make-venv From bf1eaeecb5404e2685ae27257ab5cfc35dc70b3f Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Sun, 30 Jul 2023 19:58:48 +0300 Subject: [PATCH 2/3] Fix spelling in quick start guide Signed-off-by: Nir Soffer --- docs/devel-quick-start.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devel-quick-start.md b/docs/devel-quick-start.md index 70e2780c2..65a46e60f 100644 --- a/docs/devel-quick-start.md +++ b/docs/devel-quick-start.md @@ -156,7 +156,7 @@ you are ready for the next steps: ## Undeploying the ramen operator -If you want to clean up your environment, you can uncofigure *Ramen* and +If you want to clean up your environment, you can unconfigure *Ramen* and undeploy it. ``` From a19593e86182aac25e32dc0c626ef883bd55498b Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Sun, 30 Jul 2023 20:12:15 +0300 Subject: [PATCH 3/3] Document running the tests and inspecting coverage Signed-off-by: Nir Soffer --- docs/devel-quick-start.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/devel-quick-start.md b/docs/devel-quick-start.md index 65a46e60f..017878d09 100644 --- a/docs/devel-quick-start.md +++ b/docs/devel-quick-start.md @@ -74,6 +74,30 @@ enough resources: That's all! You are ready to submit your first pull request! +## Running the tests + +To run all unit tests run: + +``` +make test +``` + +To run only part of the test suite you can use one of the `test-*` +targets, for example: + +``` +make test-vrg-vr +``` + +To open an HTML coverage report in the default browser run: + +``` +make coverage +``` + +The coverage report depends on the tests ran before inspecting the +coverage. + ## Setting up the `drenv` tool *Ramen* uses the `drenv` tool to build a development environment