diff --git a/test/e2e/infra/azure_temp_infra_setup.go b/test/e2e/infra/azure_temp_infra_setup.go index 52bf32b8a6..6bd806742a 100644 --- a/test/e2e/infra/azure_temp_infra_setup.go +++ b/test/e2e/infra/azure_temp_infra_setup.go @@ -37,13 +37,14 @@ func CreateAzureTempK8sInfra(ctx context.Context, t *testing.T, rootDir string) // CreateTestInfra createTestInfra := types.NewRunner(t, jobs.CreateTestInfra(subID, rg, clusterName, location, kubeConfigFilePath, *common.CreateInfra)) - createTestInfra.Run(ctx) - t.Cleanup(func() { err := jobs.DeleteTestInfra(subID, rg, location, *common.DeleteInfra).Run() if err != nil { t.Logf("Failed to delete test infrastructure: %v", err) } }) + + createTestInfra.Run(ctx) + return kubeConfigFilePath } diff --git a/test/e2e/scale_test.go b/test/e2e/scale_test.go index c5af899b1a..e8ca228767 100644 --- a/test/e2e/scale_test.go +++ b/test/e2e/scale_test.go @@ -91,12 +91,12 @@ func TestE2ERetina_Scale(t *testing.T) { // CreateTestInfra createTestInfra := types.NewRunner(t, jobs.CreateTestInfra(subID, rg, clusterName, location, common.KubeConfigFilePath(rootDir), *common.CreateInfra)) - createTestInfra.Run(ctx) - t.Cleanup(func() { _ = jobs.DeleteTestInfra(subID, rg, location, *common.DeleteInfra).Run() }) + createTestInfra.Run(ctx) + fqdn, err := azure.GetFqdnFn(subID, rg, clusterName) require.NoError(t, err) opt.AdditionalTelemetryProperty["clusterFqdn"] = fqdn @@ -105,10 +105,6 @@ func TestE2ERetina_Scale(t *testing.T) { installRetina := types.NewRunner(t, jobs.InstallRetina(common.KubeConfigFilePath(rootDir), common.RetinaChartPath(rootDir))) installRetina.Run(ctx) - t.Cleanup(func() { - _ = jobs.UninstallRetina(common.KubeConfigFilePath(rootDir), common.RetinaChartPath(rootDir)).Run() - }) - scale := types.NewRunner(t, jobs.ScaleTest(&opt)) scale.Run(ctx) }