Skip to content

Commit

Permalink
Merge pull request #22 from controlplaneio-fluxcd/operatorhub
Browse files Browse the repository at this point in the history
[fix] operator-sdk binary installation
  • Loading branch information
stefanprodan authored Jun 11, 2024
2 parents dba1c3a + d7b3ec0 commit 97ccaed
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ test-olm: operator-sdk opm-index
./config/operatorhub/flux-operator/testdata/003-catalog-source.yaml
export OLM_VERSION=${OLM_VERSION} && \
export FLUX_OPERATOR_VERSION=${FLUX_OPERATOR_VERSION} && \
export OPERATOR_SDK_BIN=$(OPERATOR_SDK) && \
go test ./test/olm/ -v -ginkgo.v

.PHONY: deploy-olm-data
Expand All @@ -186,7 +187,7 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk-$(OPERATOR_SDK_VERSION)

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.1
Expand Down
21 changes: 14 additions & 7 deletions test/olm/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ import (
)

const (
namespace = "flux-system"
defaultVersion = "v0.3.0"
defaultOLMVersion = "v0.28.0"
namespace = "flux-system"
defaultVersion = "v0.3.0"
defaultOLMVersion = "v0.28.0"
defaultOperatorsdkBin = "bin/operator-sdk"
)

var (
version string
img string
version string
img string
operatorsdkBin string
)

// Build the flux-operator image and deploy it to the Kind cluster.
Expand All @@ -34,6 +36,11 @@ var _ = BeforeSuite(func() {
olmVersion = defaultOLMVersion
}

operatorsdkBin = os.Getenv("OPERATOR_SDK_BIN")
if operatorsdkBin == "" {
operatorsdkBin = defaultOperatorsdkBin
}

img = fmt.Sprintf("ghcr.io/controlplaneio-fluxcd/openshift-flux-operator-catalog:bundle-%s", version)
opm := fmt.Sprintf("ghcr.io/controlplaneio-fluxcd/openshift-flux-operator-index:%s", version)

Expand All @@ -44,9 +51,9 @@ var _ = BeforeSuite(func() {
ExpectWithOffset(1, err).NotTo(HaveOccurred())

By("installing OLM")
cmd := exec.Command("bin/operator-sdk", "olm", "install", "--version", olmVersion)
cmd := exec.Command(operatorsdkBin, "olm", "install", "--version", olmVersion)
_, err = utils.Run(cmd, "/test/olm")
ExpectWithOffset(1, err).NotTo(HaveOccurred())
ExpectWithOffset(3, err).NotTo(HaveOccurred())

By("deploying flux-operator olm kubernetes resources")
cmd = exec.Command("make", "deploy-olm-data")
Expand Down
2 changes: 1 addition & 1 deletion test/olm/scorecard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var _ = Describe("Scorecard", Ordered, func() {
Context("test", func() {
It("should run successfully", func() {
By("run scorecard tests")
cmd := exec.Command("bin/operator-sdk", "scorecard",
cmd := exec.Command(operatorsdkBin, "scorecard",
img, "-c", "config/operatorhub/flux-operator/"+version+"/tests/scorecard/config.yaml",
"-w", "60s", "-o", "json")
_, err := utils.Run(cmd, "/test/olm")
Expand Down

0 comments on commit 97ccaed

Please sign in to comment.