Skip to content

Commit

Permalink
fix: clean up the release created by the test (konflux-ci#1217)
Browse files Browse the repository at this point in the history
* fix: expect EC check not to fail (konflux-ci#1197)

Instead of looking at "SUCCESS" as the result we can look at the result
not being a "FAILURE", this way we can tolerate warnings as well.

Resolves: https://issues.redhat.com/browse/KFLUXBUGS-1314

* fix: clean up release after the test is finished

Signed-off-by: Jing Qi <[email protected]>

clean up the random release version created in the test.

---------

Co-authored-by: Zoran Regvart <[email protected]>
  • Loading branch information
jinqi7 and zregvart authored Jun 11, 2024
1 parent e979a06 commit c7eaad7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/release/pipelines/release_to_github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))

Expand All @@ -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{
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
})
})
})
Expand Down

0 comments on commit c7eaad7

Please sign in to comment.