Skip to content

Commit

Permalink
Merge pull request #24 from controlplaneio-fluxcd/olm-test
Browse files Browse the repository at this point in the history
ci: Improve OPM build for e2e testing
  • Loading branch information
stefanprodan authored Jun 11, 2024
2 parents d79c540 + d164324 commit 0a9bcac
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IMG ?= ghcr.io/controlplaneio-fluxcd/flux-operator:latest

# FLUX_OPERATOR_VERSION refers to the version of the operator to be tested
# under ./config/operatorhub/flux-operator/<version> directory.
FLUX_OPERATOR_VERSION ?= v0.1.0
FLUX_OPERATOR_VERSION ?= $(shell gh release view --json tagName -q '.tagName')
# OLM_VERSION refers to the version of the Operator Lifecycle Manager to be used.
OLM_VERSION ?= 0.28.0

Expand Down
5 changes: 2 additions & 3 deletions config/operatorhub/flux-operator/scripts/opm-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ docker build -t ghcr.io/controlplaneio-fluxcd/openshift-flux-operator-catalog:bu
-f "${DIR}/bundle.Dockerfile" "${DIR}/${VERSION}"
docker push ghcr.io/controlplaneio-fluxcd/openshift-flux-operator-catalog:bundle-"${VERSION}"

docker build -t opm --build-arg ARCH=$ARCH -f "${DIR}/Dockerfile.opm" .
docker build -t opm --build-arg ARCH=$ARCH -f "${DIR}/opm.Dockerfile" .

docker run --rm -it \
--privileged \
docker run --rm --privileged \
-v /var/lib/docker:/var/lib/docker \
-v /var/run/docker.sock:/var/run/docker.sock \
opm:latest index add \
Expand Down
11 changes: 10 additions & 1 deletion test/olm/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"strings"
"time"

utils "github.com/controlplaneio-fluxcd/flux-operator/test/e2e"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

utils "github.com/controlplaneio-fluxcd/flux-operator/test/e2e"
)

const (
Expand Down Expand Up @@ -97,4 +98,12 @@ var _ = AfterSuite(func() {
cmd := exec.Command("make", "undeploy-olm-data")
_, err := utils.Run(cmd, "/test/olm")
Expect(err).NotTo(HaveOccurred())

operatorsdkBin = os.Getenv("OPERATOR_SDK_BIN")
if operatorsdkBin == "" {
operatorsdkBin = defaultOperatorsdkBin
}
cmd = exec.Command(operatorsdkBin, "olm", "uninstall")
_, err = utils.Run(cmd, "/test/olm")
Expect(err).NotTo(HaveOccurred())
})
5 changes: 3 additions & 2 deletions test/olm/scorecard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package e2eolm
import (
"os/exec"

utils "github.com/controlplaneio-fluxcd/flux-operator/test/e2e"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

utils "github.com/controlplaneio-fluxcd/flux-operator/test/e2e"
)

var _ = Describe("Scorecard", Ordered, func() {
Expand All @@ -14,7 +15,7 @@ var _ = Describe("Scorecard", Ordered, func() {
By("run scorecard tests")
cmd := exec.Command(operatorsdkBin, "scorecard",
img, "-c", "config/operatorhub/flux-operator/"+version+"/tests/scorecard/config.yaml",
"-w", "60s", "-o", "json")
"-w", "5m", "-o", "json")
_, err := utils.Run(cmd, "/test/olm")
ExpectWithOffset(2, err).NotTo(HaveOccurred())
})
Expand Down

0 comments on commit 0a9bcac

Please sign in to comment.