Skip to content

Commit

Permalink
Revert "make self-desctructing namespaces optional"
Browse files Browse the repository at this point in the history
This reverts commit ffe3460.

On-behalf-of: SAP <[email protected]>
Signed-off-by: Simon Bein <[email protected]>
  • Loading branch information
SimonTheLeg committed Feb 10, 2025
1 parent df3534e commit 2a00b74
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion test/e2e/frontproxies/frontproxies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestCreateFrontProxy(t *testing.T) {
ctx := context.Background()
namespace := "create-frontproxy"

utils.CreateNamespace(t, ctx, client, namespace, true)
utils.CreateSelfDestructingNamespace(t, ctx, client, namespace)

// deploy rootshard
rootShard := utils.DeployRootShard(ctx, t, client, namespace)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/rootshards/rootshards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestCreateRootShard(t *testing.T) {
ctx := context.Background()
namespace := "create-rootshard"

utils.CreateNamespace(t, ctx, client, namespace, true)
utils.CreateSelfDestructingNamespace(t, ctx, client, namespace)
rootShard := utils.DeployRootShard(ctx, t, client, namespace)

configSecretName := "kubeconfig"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/shards/shards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestCreateShard(t *testing.T) {

// create namspace
namespace := "create-shard"
utils.CreateNamespace(t, ctx, client, namespace, true)
utils.CreateSelfDestructingNamespace(t, ctx, client, namespace)

// deploy a root shard incl. etcd
rootShard := utils.DeployRootShard(ctx, t, client, namespace)
Expand Down
16 changes: 7 additions & 9 deletions test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func GetKubeClient(t *testing.T) ctrlruntimeclient.Client {
return c
}

func CreateNamespace(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, name string, selfDestructing bool) {
func CreateSelfDestructingNamespace(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, name string) {
t.Helper()

ns := corev1.Namespace{}
Expand All @@ -88,14 +88,12 @@ func CreateNamespace(t *testing.T, ctx context.Context, client ctrlruntimeclient
t.Fatal(err)
}

if selfDestructing {
t.Cleanup(func() {
t.Logf("Deleting namespace %s…", name)
if err := client.Delete(ctx, &ns); err != nil {
t.Fatal(err)
}
})
}
t.Cleanup(func() {
t.Logf("Deleting namespace %s…", name)
if err := client.Delete(ctx, &ns); err != nil {
t.Fatal(err)
}
})
}

func SelfDestuctingPortForward(
Expand Down

0 comments on commit 2a00b74

Please sign in to comment.