diff --git a/tests/release/pipelines/release_to_github.go b/tests/release/pipelines/release_to_github.go index 505b2986d..c3b912fda 100644 --- a/tests/release/pipelines/release_to_github.go +++ b/tests/release/pipelines/release_to_github.go @@ -30,7 +30,6 @@ import ( const ( sampServiceAccountName = "release-service-account" sampSourceGitURL = "https://github.com/redhat-appstudio-qe/devfile-sample-go-basic" - sampReleaseURL = "https://github.com/redhat-appstudio-qe/devfile-sample-go-basic/releases/tag/v2.1" sampRepoOwner = "redhat-appstudio-qe" sampRepo = "devfile-sample-go-basic" sampCatalogPathInRepo = "pipelines/release-to-github/release-to-github.yaml" @@ -58,6 +57,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for release-to-github var releaseCR *releaseapi.Release var releasePR, buildPR *tektonv1.PipelineRun var gh *github.Github + var sampReleaseURL string AfterEach(framework.ReportFailure(&devFw)) @@ -78,11 +78,6 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for release-to-github gh, err = github.NewGithubClient(githubToken, githubUser) Expect(githubToken).ToNot(BeEmpty()) - // Remove the release if the release exists - if gh.CheckIfReleaseExist(sampRepoOwner, sampRepo, sampReleaseURL) { - gh.DeleteRelease(sampRepoOwner, sampRepo, sampReleaseURL) - } - _, err = managedFw.AsKubeAdmin.CommonController.GetSecret(managedNamespace, releasecommon.RedhatAppstudioQESecret) if errors.IsNotFound(err) { githubSecret := &corev1.Secret{ @@ -122,6 +117,10 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for release-to-github Expect(devFw.AsKubeDeveloper.HasController.DeleteApplication(sampApplicationName, devNamespace, false)).NotTo(HaveOccurred()) Expect(managedFw.AsKubeDeveloper.TektonController.DeleteEnterpriseContractPolicy(sampEnterpriseContractPolicyName, managedNamespace, false)).NotTo(HaveOccurred()) Expect(managedFw.AsKubeDeveloper.ReleaseController.DeleteReleasePlanAdmission(sampReleasePlanAdmissionName, managedNamespace, false)).NotTo(HaveOccurred()) + + if gh.CheckIfReleaseExist(sampRepoOwner, sampRepo, sampReleaseURL) { + gh.DeleteRelease(sampRepoOwner, sampRepo, sampReleaseURL) + } }) var _ = Describe("Post-release verification", func() { @@ -197,6 +196,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for release-to-github trReleaseURL := trReleasePr.Status.TaskRunStatusFields.Results[0].Value.StringVal releaseURL := strings.Replace(trReleaseURL, "\n", "", -1) Expect(gh.CheckIfReleaseExist(sampRepoOwner, sampRepo, releaseURL)).To(BeTrue(), fmt.Sprintf("release %s doesn't exist", releaseURL)) + sampReleaseURL = releaseURL }) }) })