Skip to content

Commit 908efc4

Browse files
committed
count only active ns and wait for namespace clean up
Signed-off-by: akihikokuroda <[email protected]>
1 parent fe101a6 commit 908efc4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/e2e/csv_e2e_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"k8s.io/apimachinery/pkg/api/equality"
2020
k8serrors "k8s.io/apimachinery/pkg/api/errors"
2121
"k8s.io/apimachinery/pkg/api/meta"
22+
"k8s.io/apimachinery/pkg/fields"
2223
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2324
k8slabels "k8s.io/apimachinery/pkg/labels"
2425
"k8s.io/apimachinery/pkg/runtime"
@@ -4247,6 +4248,20 @@ var _ = Describe("Disabling copied CSVs", func() {
42474248
return nil
42484249
}).Should(Succeed())
42494250
TeardownNamespace(ns.GetName())
4251+
Eventually(func() bool {
4252+
var namespaces corev1.NamespaceList
4253+
err := ctx.Ctx().Client().List(context.Background(), &namespaces, &client.ListOptions{})
4254+
if err != nil || len(namespaces.Items) == 0{
4255+
return false
4256+
}
4257+
for _, n := range namespaces.Items {
4258+
if ns.GetName() == n.GetName() {
4259+
return false
4260+
}
4261+
}
4262+
4263+
return true
4264+
}).Should(BeTrue())
42504265
})
42514266

42524267
When("an operator is installed in AllNamespace mode", func() {
@@ -4403,7 +4418,7 @@ var _ = Describe("Disabling copied CSVs", func() {
44034418
}
44044419

44054420
var namespaces corev1.NamespaceList
4406-
if err := ctx.Ctx().Client().List(context.TODO(), &namespaces, &client.ListOptions{}); err != nil {
4421+
if err := ctx.Ctx().Client().List(context.TODO(), &namespaces, &client.ListOptions{FieldSelector: fields.SelectorFromSet(map[string]string{"status.phase": "Active"})}); err != nil {
44074422
return err
44084423
}
44094424

0 commit comments

Comments
 (0)