Skip to content

Commit 40beff8

Browse files
committed
test: Delete CRs and reconcile, ignoring dummy-deployment errors
1 parent aba2bb6 commit 40beff8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

controllers/suite_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"path/filepath"
2323
"slices"
24+
"strings"
2425
"testing"
2526

2627
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -255,4 +256,14 @@ func reconcileAndValidateCondition(r GrafanaCommonReconciler, cr v1beta1.CommonR
255256
require.NoError(t, err)
256257

257258
containsEqualCondition(cr.CommonStatus().Conditions, condition)
259+
260+
err = k8sClient.Delete(testCtx, cr)
261+
require.NoError(t, err)
262+
263+
_, err = r.Reconcile(testCtx, req)
264+
if err != nil && strings.Contains(err.Error(), "dummy-deployment") {
265+
require.Error(t, err)
266+
} else {
267+
require.NoError(t, err)
268+
}
258269
}

0 commit comments

Comments
 (0)