Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(e2e): Use X.Y channels for OLM upgrade e2e tests #2901

Merged
merged 3 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ jobs:
export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
export LOCAL_IMAGE_BUNDLE=${KIND_REGISTRY}/apache/camel-k-bundle:${{ env.LOCAL_IMAGE_VERSION }}
echo "LOCAL_IMAGE_BUNDLE=${LOCAL_IMAGE_BUNDLE}" >> $GITHUB_ENV
make bundle-build BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} DEFAULT_CHANNEL="stable" CHANNELS="stable"
export PREV_XY_CHANNEL=stable-$(make get-last-released-version | grep -Po "\d.\d")
echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
export NEW_XY_CHANNEL=stable-$(make get-version | grep -Po "\d.\d")
echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV
make bundle-build BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" CHANNELS="stable,${NEW_XY_CHANNEL}"
docker push ${LOCAL_IMAGE_BUNDLE}
- name: Create new index image
run: |
Expand All @@ -155,6 +159,8 @@ jobs:
export CAMEL_K_NEW_IIB=${{ env.LOCAL_IIB }}
export KAMEL_K_TEST_RELEASE_VERSION=$(make get-last-released-version)
export KAMEL_K_TEST_OPERATOR_CURRENT_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
export CAMEL_K_PREV_UPGRADE_CHANNEL=${{ env.PREV_XY_CHANNEL }}
export CAMEL_K_NEW_UPGRADE_CHANNEL=${{ env.NEW_XY_CHANNEL }}

# Then run integration tests
make test-upgrade
8 changes: 5 additions & 3 deletions e2e/upgrade/olm_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func TestOLMAutomaticUpgrade(t *testing.T) {

args := []string{"install", "-n", ns, "--olm=true", "--olm-source", catalogSourceName, "--olm-source-namespace", ns}

if crossChannelUpgrade {
args = append(args, "--olm-channel", os.Getenv("CAMEL_K_PREV_UPGRADE_CHANNEL"))
if prevUpdateChannel != "" {
args = append(args, "--olm-channel", prevUpdateChannel)
}

Expect(Kamel(args...).Execute()).To(Succeed())
Expand Down Expand Up @@ -121,10 +121,12 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
if crossChannelUpgrade {
t.Log("Updating Camel-K subscription OLM update channel.")
s := ckSubscription(ns)()
ctrlutil.CreateOrUpdate(TestContext, TestClient(), s, func() error {
r, err := ctrlutil.CreateOrUpdate(TestContext, TestClient(), s, func() error {
s.Spec.Channel = newUpdateChannel
return nil
})
Expect(err).To(BeNil())
Expect(r).To(Equal(ctrlutil.OperationResultUpdated))
}
// Check the previous CSV is being replaced
Eventually(clusterServiceVersionPhase(func(csv olm.ClusterServiceVersion) bool {
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/camel/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ func GenerateCatalogCommon(
mc.AddSystemProperty("catalog.file", "catalog.yaml")
mc.AddSystemProperty("catalog.runtime", string(runtime.Provider))

if globalSettings != nil {
if len(globalSettings) > 0 {
mc.GlobalSettings = globalSettings
}
if userSettings != nil {
if len(userSettings) > 0 {
mc.UserSettings = userSettings
}

Expand Down