diff --git a/tests/integration-service/group-snapshots-tests.go b/tests/integration-service/group-snapshots-tests.go index d700b34da..772c6b9ab 100644 --- a/tests/integration-service/group-snapshots-tests.go +++ b/tests/integration-service/group-snapshots-tests.go @@ -76,7 +76,7 @@ var _ = framework.IntegrationServiceSuiteDescribe("Creation of group snapshots f AfterAll(func() { if !CurrentSpecReport().Failed() { - cleanup(*f, testNamespace, applicationName, componentA.Name) + cleanup(*f, testNamespace, applicationName, componentA.Name, snapshot) } // Delete new branches created by PaC and a testing branch used as a component's base branch diff --git a/tests/integration-service/integration.go b/tests/integration-service/integration.go index 6240f824f..43d625619 100644 --- a/tests/integration-service/integration.go +++ b/tests/integration-service/integration.go @@ -62,9 +62,7 @@ var _ = framework.IntegrationServiceSuiteDescribe("Integration Service E2E tests AfterAll(func() { if !CurrentSpecReport().Failed() { - cleanup(*f, testNamespace, applicationName, componentName) - - Expect(f.AsKubeAdmin.IntegrationController.DeleteSnapshot(snapshotPush, testNamespace)).To(Succeed()) + cleanup(*f, testNamespace, applicationName, componentName, snapshotPush) } // Delete new branches created by PaC and a testing branch used as a component's base branch @@ -253,7 +251,7 @@ var _ = framework.IntegrationServiceSuiteDescribe("Integration Service E2E tests AfterAll(func() { if !CurrentSpecReport().Failed() { - cleanup(*f, testNamespace, applicationName, componentName) + cleanup(*f, testNamespace, applicationName, componentName, snapshotPush) } // Delete new branches created by PaC and a testing branch used as a component's base branch @@ -493,16 +491,17 @@ func createComponentWithCustomBranch(f framework.Framework, testNamespace, appli return originalComponent } -func cleanup(f framework.Framework, testNamespace, applicationName, componentName string) { +func cleanup(f framework.Framework, testNamespace, applicationName, componentName string, snapshot *appstudioApi.Snapshot) { if !CurrentSpecReport().Failed() { - Expect(f.AsKubeAdmin.HasController.DeleteApplication(applicationName, testNamespace, false)).To(Succeed()) - Expect(f.AsKubeAdmin.HasController.DeleteComponent(componentName, testNamespace, false)).To(Succeed()) + Expect(f.AsKubeAdmin.IntegrationController.DeleteSnapshot(snapshot, testNamespace)).To(Succeed()) integrationTestScenarios, err := f.AsKubeAdmin.IntegrationController.GetIntegrationTestScenarios(applicationName, testNamespace) Expect(err).ShouldNot(HaveOccurred()) for _, testScenario := range *integrationTestScenarios { Expect(f.AsKubeAdmin.IntegrationController.DeleteIntegrationTestScenario(&testScenario, testNamespace)).To(Succeed()) } + Expect(f.AsKubeAdmin.HasController.DeleteComponent(componentName, testNamespace, false)).To(Succeed()) + Expect(f.AsKubeAdmin.HasController.DeleteApplication(applicationName, testNamespace, false)).To(Succeed()) Expect(f.SandboxController.DeleteUserSignup(f.UserName)).To(BeTrue()) } } diff --git a/tests/integration-service/status-reporting-to-pullrequest.go b/tests/integration-service/status-reporting-to-pullrequest.go index 092dcd7ef..121444363 100644 --- a/tests/integration-service/status-reporting-to-pullrequest.go +++ b/tests/integration-service/status-reporting-to-pullrequest.go @@ -59,7 +59,7 @@ var _ = framework.IntegrationServiceSuiteDescribe("Status Reporting of Integrati AfterAll(func() { if !CurrentSpecReport().Failed() { - cleanup(*f, testNamespace, applicationName, componentName) + cleanup(*f, testNamespace, applicationName, componentName, snapshot) } // Delete new branches created by PaC and a testing branch used as a component's base branch