Skip to content

Commit 19cbfac

Browse files
committed
feat(tests): validate_running_must_gather.go: permit image override
Signed-off-by: Oliver Gondža <[email protected]>
1 parent efdc587 commit 19cbfac

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

test/openshift/e2e/ginkgo/parallel/1-120_validate_running_must_gather.go

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
. "github.com/onsi/ginkgo/v2"
2929
. "github.com/onsi/gomega"
3030
"github.com/onsi/gomega/types"
31-
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
3231
"github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture"
3332
argocdFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/argocd"
3433
fixtureUtils "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/utils"
@@ -38,9 +37,11 @@ import (
3837
"sigs.k8s.io/controller-runtime/pkg/client"
3938
)
4039

41-
// MustGatherImage is a good place to insert development image
42-
// Known to be buggy in 1.17.0
43-
const MustGatherImage = "registry.redhat.io/openshift-gitops-1/must-gather-rhel8:v1.16.0" // TODO, use tag name with SUT version
40+
// default used when E2E_MUST_GATHER_IMAGE is not set.
41+
// CI images:
42+
// - quay.io/redhat-user-workloads/rh-openshift-gitops-tenant/gitops-must-gather:on-pr-<GIT_COMMIT_SHA>
43+
// - quay.io/redhat-user-workloads/rh-openshift-gitops-tenant/gitops-must-gather:<GIT_COMMIT_SHA>
44+
const defaultMustGatherImage = "quay.io/redhat-user-workloads/rh-openshift-gitops-tenant/gitops-must-gather:latest"
4445

4546
var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
4647

@@ -58,7 +59,6 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
5859
})
5960

6061
It("verified the files collected for must gather are valid", func() {
61-
6262
By("creating namespace-scoped Argo CD instance")
6363
ns, nsCleanup := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc()
6464
defer nsCleanup()
@@ -114,7 +114,7 @@ func gather() string {
114114

115115
stdout, err := osFixture.ExecCommandWithOutputParam(
116116
true,
117-
"oc", "adm", "must-gather", "--image", MustGatherImage, "--dest-dir", destDir,
117+
"oc", "adm", "must-gather", "--image", mustGatherImage(), "--dest-dir", destDir,
118118
)
119119
Expect(err).ToNot(HaveOccurred())
120120

@@ -144,17 +144,12 @@ func resourcesDir(destDir string) string {
144144
return path.Join(destDir, subdirs[0])
145145
}
146146

147-
func isCSVInstalled(ctx context.Context, k8sClient client.Client, subscription *operatorsv1alpha1.Subscription) bool {
148-
key := client.ObjectKey{
149-
Name: subscription.Name,
150-
Namespace: subscription.Namespace,
151-
}
152-
153-
if err := k8sClient.Get(ctx, key, subscription); err != nil {
154-
return false
147+
func mustGatherImage() string {
148+
injected := os.Getenv("E2E_MUST_GATHER_IMAGE")
149+
if injected == "" {
150+
return defaultMustGatherImage
155151
}
156-
157-
return subscription.Status.InstalledCSV != ""
152+
return injected
158153
}
159154

160155
// BeValidResourceFile checks if the file exists and if it is a valid YAML file.

0 commit comments

Comments
 (0)