Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify the tests by moving the validation code into the util package. util.ValidateRamenHubOperator() and util.ValidateDRClusterOperator() returns now and error if ramen operator is not in valid state, and nil if the operator is in good state. They also log information about the pod. Separate looking up the ramen operator pod, and checking for its status. This way when the pod is not running we return an error with more context (e.g pod name, pod phase). Tests are using sub tests to have one test per cluster, which makes test output more clear. We use the virtual cluster names ("c1", "c2"). This can be improved later by getting the cluster names from the dr policy, the clusterset, or the environment file. Example run - ramen not deployed: % go test -run TestSuites/Validate --config ../e2e.yaml 2024-10-29T19:32:09.522+0200 INFO e2e/main_test.go:41 Global setting {"Timeout": 600} 2024-10-29T19:32:09.523+0200 INFO e2e/main_test.go:42 Global setting {"Retry Interval": 30} 2024-10-29T19:32:09.523+0200 INFO e2e/main_test.go:57 TestSuites --- FAIL: TestSuites (0.06s) --- FAIL: TestSuites/Validate (0.06s) --- FAIL: TestSuites/Validate/hub (0.03s) validation_suite_test.go:17: no pod with labelSelctor "app=ramen-hub" and identifier "ramen-hub-operator" in namespace "ramen-system" --- FAIL: TestSuites/Validate/c1 (0.02s) validation_suite_test.go:23: no pod with labelSelctor "app=ramen-dr-cluster" and identifier "ramen-dr-cluster-operator" in namespace "ramen-system" --- FAIL: TestSuites/Validate/c2 (0.02s) validation_suite_test.go:29: no pod with labelSelctor "app=ramen-dr-cluster" and identifier "ramen-dr-cluster-operator" in namespace "ramen-system" main_test.go:60: failed to validate the test suite FAIL exit status 1 FAIL github.com/ramendr/ramen/e2e 0.683s Example run - ramen deployed: % go test -run TestSuites/Validate --config ../e2e.yaml 2024-10-29T19:43:51.899+0200 INFO e2e/main_test.go:41 Global setting {"Timeout": 600} 2024-10-29T19:43:51.900+0200 INFO e2e/main_test.go:42 Global setting {"Retry Interval": 30} 2024-10-29T19:43:51.901+0200 INFO e2e/main_test.go:57 TestSuites 2024-10-29T19:43:51.932+0200 INFO util/validation.go:35 Ramen hub operator is running {"pod": "ramen-hub-operator-659658dfcf-c2xnj"} 2024-10-29T19:43:51.951+0200 INFO util/validation.go:59 Ramen dr cluster operator is running {"cluster": "c1", "pod": "ramen-dr-cluster-operator-74f89d85d7-nwx54"} 2024-10-29T19:43:51.970+0200 INFO util/validation.go:59 Ramen dr cluster operator is running {"cluster": "c2", "pod": "ramen-dr-cluster-operator-74f89d85d7-6gjhs"} PASS ok github.com/ramendr/ramen/e2e 0.759s Signed-off-by: Nir Soffer <nsoffer@redhat.com>
- Loading branch information