From 1458bbd908fc49f45abd8f5bd1fdf60e205b6dfe Mon Sep 17 00:00:00 2001 From: Suraj Deshmukh Date: Mon, 3 Aug 2020 20:33:07 +0530 Subject: [PATCH] prometheus-operator: Fix unit test Return when the test that wants error, errors out. This means the test has passed and should not be proceeded further. Signed-off-by: Suraj Deshmukh --- pkg/components/prometheus-operator/component_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/components/prometheus-operator/component_test.go b/pkg/components/prometheus-operator/component_test.go index a69c35e71..c3166de17 100644 --- a/pkg/components/prometheus-operator/component_test.go +++ b/pkg/components/prometheus-operator/component_test.go @@ -81,6 +81,10 @@ component "prometheus-operator" { if tc.wantErr && !d.HasErrors() { t.Fatal("wrong config should have returned an error") + } else if tc.wantErr && d.HasErrors() { + // This means that test has passed and there is no need to go forward, we can safely + // return. + return } m, err := c.RenderManifests()