Skip to content

Commit 6c4e186

Browse files
committed
Increase the timeout when testing namespace deletion
1 parent 347d3b0 commit 6c4e186

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

internal/controller/postgrescluster/delete_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,12 @@ func TestReconcilerHandleDeleteNamespace(t *testing.T) {
486486
return apierrors.IsNotFound(err), client.IgnoreNotFound(err)
487487
}), "expected cluster to be deleted, got:\n%+v", *cluster)
488488

489-
assert.NilError(t, wait.PollImmediate(time.Second, Scale(time.Minute/2), func() (bool, error) {
490-
err := cc.Get(ctx, client.ObjectKeyFromObject(ns), &corev1.Namespace{})
489+
// Kubernetes will continue to remove things after the PostgresCluster is gone.
490+
// In some cases, a Pod might get stuck in a deleted-and-creating state.
491+
// Conditions in the Namespace status indicate what is going on.
492+
var namespace corev1.Namespace
493+
assert.NilError(t, wait.PollImmediate(time.Second, Scale(3*time.Minute), func() (bool, error) {
494+
err := cc.Get(ctx, client.ObjectKeyFromObject(ns), &namespace)
491495
return apierrors.IsNotFound(err), client.IgnoreNotFound(err)
492-
}), "expected namespace to be deleted")
496+
}), "expected namespace to be deleted, got status:\n%+v", namespace.Status)
493497
}

0 commit comments

Comments
 (0)