Skip to content

Commit

Permalink
fix(test): fix test cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Castilio dos Santos <[email protected]>
  • Loading branch information
alexcastilio committed Jan 30, 2025
1 parent 20d1efd commit 12fedc8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 3 additions & 2 deletions test/e2e/infra/azure_temp_infra_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 2 additions & 6 deletions test/e2e/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}

0 comments on commit 12fedc8

Please sign in to comment.