You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/05/17 06:58:01 UTC
[camel-k] branch release-1.4.x updated (cad7f9c -> 146eefc)
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a change to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git.
from cad7f9c fix(cmd): run file system stat errors
new 0a156fa fix(ci): Use Docker to build OLM index image
new f167ac6 fix(e2e): Patch the OLM bundle CSV with replaces field
new 94f5413 fix(e2e): Use correct OLM bundle CSV name in Kustomize patch
new 6f64d3e chore(e2e): Polish upgrade e2e tests
new 0cc0e63 chore(e2e): Remove CRDs after OLM uninstall
new f5d049f chore(e2e): Remove obsolete operator upgrade e2e test
new 10b35ec chore(e2e): Assert upgraded integration Pod uses new version Kit
new e25ac1c chore(e2e): List Builds when dumping Namespace
new 146eefc fix(olm): Update CSV base template
The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/upgrade.yml | 14 +-
.../bases/camel-k.clusterserviceversion.yaml | 6 +-
e2e/common/upgrade_test.go | 55 --------
e2e/support/test_support.go | 95 +++-----------
e2e/support/util/dump.go | 14 +-
...pgrade_operator_test.go => cli_upgrade_test.go} | 60 +++++----
e2e/upgrade/olm_upgrade_test.go | 143 ++++++++++++---------
e2e/upgrade/util.go | 92 +++++++++++++
8 files changed, 257 insertions(+), 222 deletions(-)
delete mode 100644 e2e/common/upgrade_test.go
rename e2e/upgrade/{upgrade_operator_test.go => cli_upgrade_test.go} (63%)
create mode 100644 e2e/upgrade/util.go
[camel-k] 09/09: fix(olm): Update CSV base template
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 146eefcf1416eeb8418a19fb9db6eafc0dc74ca4
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed May 12 17:05:30 2021 +0200
fix(olm): Update CSV base template
---
config/manifests/bases/camel-k.clusterserviceversion.yaml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/config/manifests/bases/camel-k.clusterserviceversion.yaml b/config/manifests/bases/camel-k.clusterserviceversion.yaml
index e3ee705..c189d4f 100644
--- a/config/manifests/bases/camel-k.clusterserviceversion.yaml
+++ b/config/manifests/bases/camel-k.clusterserviceversion.yaml
@@ -22,15 +22,15 @@ metadata:
capabilities: Full Lifecycle
categories: Integration & Delivery
certified: "false"
- containerImage: docker.io/apache/camel-k:1.3.0-SNAPSHOT
+ containerImage: docker.io/apache/camel-k:1.4.1-SNAPSHOT
createdAt: 2021-04-07T08:20:51Z
description: Apache Camel K is a lightweight integration platform, born on Kubernetes, with serverless superpowers.
- operators.operatorframework.io/builder: operator-sdk-v1.0.1
+ operators.operatorframework.io/builder: operator-sdk-v1.3.0
operators.operatorframework.io/internal-objects: '["builds.camel.apache.org","integrationkits.camel.apache.org","camelcatalogs.camel.apache.org"]'
operators.operatorframework.io/project_layout: go.kubebuilder.io/v2
repository: https://github.com/apache/camel-k
support: Camel
- name: camel-k.v1.3.0
+ name: camel-k.v1.4.1
namespace: placeholder
spec:
apiservicedefinitions: {}
[camel-k] 04/09: chore(e2e): Polish upgrade e2e tests
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 6f64d3e1943ee3c33a8d47fab3137987c34f1543
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue May 11 14:41:17 2021 +0200
chore(e2e): Polish upgrade e2e tests
---
e2e/support/test_support.go | 61 ----------
...pgrade_operator_test.go => cli_upgrade_test.go} | 30 ++---
e2e/upgrade/olm_upgrade_test.go | 123 +++++++++++----------
e2e/upgrade/util.go | 92 +++++++++++++++
4 files changed, 171 insertions(+), 135 deletions(-)
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 6e2632f..a65ca10 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -27,7 +27,6 @@ import (
"encoding/json"
"errors"
"fmt"
- v1alpha12 "github.com/operator-framework/api/pkg/operators/v1alpha1"
"io"
"io/ioutil"
"os"
@@ -35,7 +34,6 @@ import (
"strings"
"testing"
"time"
- "unsafe"
"github.com/google/uuid"
"github.com/onsi/gomega"
@@ -673,65 +671,6 @@ func KnativeService(ns string, name string) func() *servingv1.Service {
}
}
-func CKClusterServiceVersion(conditions func(v1alpha12.ClusterServiceVersion) bool ,ns string) func() *v1alpha12.ClusterServiceVersion {
- return func() *v1alpha12.ClusterServiceVersion {
- lst := v1alpha12.ClusterServiceVersionList{}
- if err := TestClient().List(TestContext, &lst, ctrl.InNamespace(ns)); err != nil {
- panic(err)
- }
- for _, s := range lst.Items {
- if strings.Contains(s.Name, "camel-k") && conditions(s){
- return &s
- }
- }
- return nil
- }
-}
-
-func CKClusterServiceVersionPhase(conditions func(v1alpha12.ClusterServiceVersion) bool, ns string) func() v1alpha12.ClusterServiceVersionPhase {
- return func() v1alpha12.ClusterServiceVersionPhase {
- if csv := CKClusterServiceVersion(conditions, ns)(); csv != nil && unsafe.Sizeof(csv.Status) > 0 {
- return csv.Status.Phase
- }
- return ""
- }
-}
-
-func CatalogSource(name string, ns string) func() *v1alpha12.CatalogSource {
- return func() *v1alpha12.CatalogSource {
- answer := v1alpha12.CatalogSource{
- TypeMeta: metav1.TypeMeta{
- Kind: "CatalogSource",
- APIVersion: v1alpha1.SchemeGroupVersion.String(),
- },
- ObjectMeta: metav1.ObjectMeta{
- Namespace: ns,
- Name: name,
- },
- }
- key := ctrl.ObjectKey{
- Namespace: ns,
- Name: name,
- }
- if err := TestClient().Get(TestContext, key, &answer); err != nil && k8serrors.IsNotFound(err) {
- return nil
- } else if err != nil {
- log.Errorf(err, "Error while retrieving CatalogSource %s", name)
- return nil
- }
- return &answer
- }
-}
-
-func CatalogSourcePhase(name string, ns string) func() string {
- return func() string {
- if source := CatalogSource(name, ns)(); source != nil && source.Status.GRPCConnectionState != nil {
- return CatalogSource(name, ns)().Status.GRPCConnectionState.LastObservedState
- }
- return ""
- }
-}
-
func Deployment(ns string, name string) func() *appsv1.Deployment {
return func() *appsv1.Deployment {
answer := appsv1.Deployment{
diff --git a/e2e/upgrade/upgrade_operator_test.go b/e2e/upgrade/cli_upgrade_test.go
similarity index 79%
rename from e2e/upgrade/upgrade_operator_test.go
rename to e2e/upgrade/cli_upgrade_test.go
index 2ce5775..095943e 100644
--- a/e2e/upgrade/upgrade_operator_test.go
+++ b/e2e/upgrade/cli_upgrade_test.go
@@ -28,10 +28,10 @@ import (
. "github.com/onsi/gomega"
- v1 "k8s.io/api/core/v1"
+ corev1 "k8s.io/api/core/v1"
. "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+ v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/util/defaults"
)
@@ -49,14 +49,14 @@ func TestOperatorUpgrade(t *testing.T) {
kamel, ok := os.LookupEnv("RELEASED_KAMEL_BIN")
Expect(ok).To(BeTrue())
- //set KAMEL_BIN only for this test - don't override the ENV variable for all tests
+ // Set KAMEL_BIN only for this test - don't override the ENV variable for all tests
Expect(os.Setenv("KAMEL_BIN", kamel)).To(Succeed())
Expect(Kamel("install", "--olm=false", "--cluster-setup", "--force").Execute()).To(Succeed())
Expect(Kamel("install", "--olm=false", "-n", ns).Execute()).To(Succeed())
// Check the operator pod is running
- Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(v1.PodRunning))
+ Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
// Refresh the test client to account for the newly installed CRDs
SyncClient()
@@ -67,11 +67,11 @@ func TestOperatorUpgrade(t *testing.T) {
// Run the Integration
name := "yaml"
Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(v1.PodRunning))
- Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
// Check the Integration version
- Eventually(IntegrationVersion(ns, "yaml")).Should(Equal(version))
- kit := IntegrationKit(ns, "yaml")()
+ Eventually(IntegrationVersion(ns, name)).Should(Equal(version))
+ kit := IntegrationKit(ns, name)()
// Clear the KAMEL_BIN environment variable so that the current version is used from now on
Expect(os.Setenv("KAMEL_BIN", "")).To(Succeed())
@@ -84,27 +84,27 @@ func TestOperatorUpgrade(t *testing.T) {
// Check the operator image is the current built one
Eventually(OperatorImage(ns)).Should(Equal(image))
// Check the operator pod is running
- Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(v1.PodRunning))
+ Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
// Check the IntegrationPlatform has been reconciled
Eventually(PlatformVersion(ns), TestTimeoutMedium).Should(Equal(defaults.Version))
// Check the Integration hasn't been upgraded
- Consistently(IntegrationVersion(ns, "yaml"), 3*time.Second).Should(Equal(version))
+ Consistently(IntegrationVersion(ns, name), 3*time.Second).Should(Equal(version))
// Force the Integration upgrade
- Expect(Kamel("rebuild", "yaml", "-n", ns).Execute()).To(Succeed())
+ Expect(Kamel("rebuild", name, "-n", ns).Execute()).To(Succeed())
// Check the Integration version change
- Eventually(IntegrationVersion(ns, "yaml")).Should(Equal(defaults.Version))
+ Eventually(IntegrationVersion(ns, name)).Should(Equal(defaults.Version))
// Check the previous kit is not garbage collected
Eventually(KitsWithVersion(ns, version)).Should(Equal(1))
// Check a new kit is created with the current version
Eventually(KitsWithVersion(ns, defaults.Version)).Should(Equal(1))
// Check the Integration uses the new kit
- Eventually(IntegrationKit(ns, "yaml"), TestTimeoutMedium).ShouldNot(Equal(kit))
+ Eventually(IntegrationKit(ns, name), TestTimeoutMedium).ShouldNot(Equal(kit))
// Check the Integration runs correctly
- Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
- Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
// Clean up
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go
index 2913493..21f6237 100644
--- a/e2e/upgrade/olm_upgrade_test.go
+++ b/e2e/upgrade/olm_upgrade_test.go
@@ -23,19 +23,24 @@ package common
import (
"fmt"
- . "github.com/apache/camel-k/e2e/support"
- . "github.com/onsi/gomega"
- "github.com/operator-framework/api/pkg/lib/version"
- "github.com/operator-framework/api/pkg/operators/v1alpha1"
- v1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"os"
- ctrl "sigs.k8s.io/controller-runtime/pkg/client"
"testing"
+
+ . "github.com/onsi/gomega"
+
+ corev1 "k8s.io/api/core/v1"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ ctrlutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
+
+ "github.com/operator-framework/api/pkg/lib/version"
+ olm "github.com/operator-framework/api/pkg/operators/v1alpha1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
-const CATALOG_SOURCE_NAME = "test-camel-k-source"
+const catalogSourceName = "test-camel-k-source"
func TestOLMAutomaticUpgrade(t *testing.T) {
prevIIB := os.Getenv("CAMEL_K_PREV_IIB")
@@ -43,23 +48,23 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
kamel := os.Getenv("RELEASED_KAMEL_BIN")
if prevIIB == "" || newIIB == "" {
- t.Skip("OLM Upgrade test needs CAMEL_K_PREV_IIB and CAMEL_K_PREV_IIB ENV variables")
+ t.Skip("OLM Upgrade test requires the CAMEL_K_PREV_IIB and CAMEL_K_NEW_IIB environment variables")
}
WithNewTestNamespace(t, func(ns string) {
- Expect(createCatalogSource(CATALOG_SOURCE_NAME, prevIIB, ns)).To(Succeed())
- Eventually(CatalogSourcePhase(CATALOG_SOURCE_NAME, ns), TestTimeoutMedium).Should(Equal("READY"))
+ Expect(createOrUpdateCatalogSource(ns, catalogSourceName, prevIIB)).To(Succeed())
+ Eventually(catalogSourcePhase(ns, catalogSourceName), TestTimeoutMedium).Should(Equal("READY"))
- //set KAMEL_BIN only for this test - don't override the ENV variable for all tests
+ // Set KAMEL_BIN only for this test - don't override the ENV variable for all tests
Expect(os.Setenv("KAMEL_BIN", kamel)).To(Succeed())
- Expect(Kamel("install", "-n", ns, "--olm=true", "--olm-source", CATALOG_SOURCE_NAME, "--olm-source-namespace", ns).Execute()).To(Succeed())
+ Expect(Kamel("install", "-n", ns, "--olm=true", "--olm-source", catalogSourceName, "--olm-source-namespace", ns).Execute()).To(Succeed())
- //find the only one Camel-K CSV
- noAdditionalConditions := func(csv v1alpha1.ClusterServiceVersion) bool {
+ // Find the only one Camel-K CSV
+ noAdditionalConditions := func(csv olm.ClusterServiceVersion) bool {
return true
}
- Eventually(CKClusterServiceVersionPhase(noAdditionalConditions, ns), TestTimeoutMedium).Should(Equal(v1alpha1.CSVPhaseSucceeded))
+ Eventually(clusterServiceVersionPhase(noAdditionalConditions, ns), TestTimeoutMedium).Should(Equal(olm.CSVPhaseSucceeded))
// Refresh the test client to account for the newly installed CRDs
SyncClient()
@@ -72,92 +77,92 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
var prevIPVersionPrefix string
var newIPVersionPrefix string
- prevCSVVersion = CKClusterServiceVersion(noAdditionalConditions, ns)().Spec.Version
+ prevCSVVersion = clusterServiceVersion(noAdditionalConditions, ns)().Spec.Version
prevIPVersionPrefix = fmt.Sprintf("%d.%d", prevCSVVersion.Version.Major, prevCSVVersion.Version.Minor)
- Expect(OperatorPod(ns)).ToNot(BeNil())
-
- Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
+ // Check the operator pod is running
+ Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ // Check the IntegrationPlatform has been reconciled
Eventually(PlatformVersion(ns)).Should(ContainSubstring(prevIPVersionPrefix))
- Expect(IntegrationVersion(ns, "yaml")()).To(ContainSubstring(prevIPVersionPrefix))
- t.Run("OLM upgrade", func(t *testing.T) {
+ name := "yaml"
+ Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ // Check the Integration runs correctly
+ Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Check the Integration version matches that of the current operator
+ Expect(IntegrationVersion(ns, name)()).To(ContainSubstring(prevIPVersionPrefix))
- //invoke OLM upgrade
- Expect(createCatalogSource(CATALOG_SOURCE_NAME, newIIB, ns)).To(Succeed())
+ t.Run("OLM upgrade", func(t *testing.T) {
+ // Trigger Camel K operator upgrade by updating the CatalogSource with the new index image
+ Expect(createOrUpdateCatalogSource(ns, catalogSourceName, newIIB)).To(Succeed())
- // previous CSV is REPLACING
- Eventually(CKClusterServiceVersionPhase(func(csv v1alpha1.ClusterServiceVersion) bool {
+ // Check the previous CSV is being replaced
+ Eventually(clusterServiceVersionPhase(func(csv olm.ClusterServiceVersion) bool {
return csv.Spec.Version.Version.String() == prevCSVVersion.Version.String()
- }, ns), TestTimeoutMedium).Should(Equal(v1alpha1.CSVPhaseReplacing))
+ }, ns), TestTimeoutMedium).Should(Equal(olm.CSVPhaseReplacing))
- // the new version is installed
- Eventually(CKClusterServiceVersionPhase(func(csv v1alpha1.ClusterServiceVersion) bool {
+ // The new CSV is installed
+ Eventually(clusterServiceVersionPhase(func(csv olm.ClusterServiceVersion) bool {
return csv.Spec.Version.Version.String() != prevCSVVersion.Version.String()
- }, ns), TestTimeoutMedium).Should(Equal(v1alpha1.CSVPhaseSucceeded))
+ }, ns), TestTimeoutMedium).Should(Equal(olm.CSVPhaseSucceeded))
- // the old version is gone
- Eventually(CKClusterServiceVersion(func(csv v1alpha1.ClusterServiceVersion) bool {
+ // The old CSV is gone
+ Eventually(clusterServiceVersion(func(csv olm.ClusterServiceVersion) bool {
return csv.Spec.Version.Version.String() == prevCSVVersion.Version.String()
}, ns), TestTimeoutMedium).Should(BeNil())
- newCSVVersion = CKClusterServiceVersion(noAdditionalConditions, ns)().Spec.Version
+ newCSVVersion = clusterServiceVersion(noAdditionalConditions, ns)().Spec.Version
newIPVersionPrefix = fmt.Sprintf("%d.%d", newCSVVersion.Version.Major, newCSVVersion.Version.Minor)
Expect(prevCSVVersion.Version.String()).NotTo(Equal(newCSVVersion.Version.String()))
- Eventually(OperatorPodPhase(ns)).Should(Equal(v1.PodRunning))
+ Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ // Check the IntegrationPlatform has been reconciled
Eventually(PlatformVersion(ns)).Should(ContainSubstring(newIPVersionPrefix))
})
t.Run("Integration upgrade", func(t *testing.T) {
-
// Clear the KAMEL_BIN environment variable so that the current version is used from now on
Expect(os.Setenv("KAMEL_BIN", "")).To(Succeed())
- Expect(IntegrationVersion(ns, "yaml")()).To(ContainSubstring(prevIPVersionPrefix))
- Expect(Kamel("rebuild", "yaml", "-n", ns).Execute()).To(Succeed())
+ // Check the Integration is still running the old version
+ Expect(IntegrationVersion(ns, name)()).To(ContainSubstring(prevIPVersionPrefix))
+
+ // Rebuild the Integration
+ Expect(Kamel("rebuild", name, "-n", ns).Execute()).To(Succeed())
- Eventually(IntegrationVersion(ns, "yaml"), TestTimeoutMedium).Should(ContainSubstring(newIPVersionPrefix))
- Eventually(IntegrationPodPhase(ns, "yaml")).Should(Equal(v1.PodRunning))
+ // Check the Integration runs correctly
+ Eventually(IntegrationPodPhase(ns, name)).Should(Equal(corev1.PodRunning))
+ // Check the Integration has upgraded
+ Eventually(IntegrationVersion(ns, name), TestTimeoutMedium).Should(ContainSubstring(newIPVersionPrefix))
// Clean up
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
Expect(Kamel("uninstall", "-n", ns).Execute()).To(Succeed())
})
-
})
}
-func createCatalogSource(name string, image string, ns string) error {
- catalogSource := v1alpha1.CatalogSource{
- TypeMeta: metav1.TypeMeta{
- Kind: "CatalogSource",
- APIVersion: v1alpha1.SchemeGroupVersion.String(),
- },
+func createOrUpdateCatalogSource(ns, name, image string) error {
+ catalogSource := &olm.CatalogSource{
ObjectMeta: metav1.ObjectMeta{
Namespace: ns,
Name: name,
},
}
- key := ctrl.ObjectKey{
- Namespace: ns,
- Name: name,
- }
- if err := TestClient().Get(TestContext, key, &catalogSource); errors.IsNotFound(err) {
- catalogSource.Spec = v1alpha1.CatalogSourceSpec{
+
+ _, err := ctrlutil.CreateOrUpdate(TestContext, TestClient(), catalogSource, func() error {
+ catalogSource.Spec = olm.CatalogSourceSpec{
Image: image,
SourceType: "grpc",
DisplayName: "OLM upgrade test Catalog",
Publisher: "grpc",
}
- return TestClient().Create(TestContext, &catalogSource)
- } else {
- catalogSource.Spec.Image = image
- return TestClient().Update(TestContext, &catalogSource)
- }
+ return nil
+ })
+ return err
}
diff --git a/e2e/upgrade/util.go b/e2e/upgrade/util.go
new file mode 100644
index 0000000..0b6d667
--- /dev/null
+++ b/e2e/upgrade/util.go
@@ -0,0 +1,92 @@
+// +build integration
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package common
+
+import (
+ "strings"
+ "unsafe"
+
+ "k8s.io/apimachinery/pkg/api/errors"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ ctrl "sigs.k8s.io/controller-runtime/pkg/client"
+
+ olm "github.com/operator-framework/api/pkg/operators/v1alpha1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ "github.com/apache/camel-k/pkg/util/log"
+)
+
+func clusterServiceVersion(conditions func(olm.ClusterServiceVersion) bool, ns string) func() *olm.ClusterServiceVersion {
+ return func() *olm.ClusterServiceVersion {
+ lst := olm.ClusterServiceVersionList{}
+ if err := TestClient().List(TestContext, &lst, ctrl.InNamespace(ns)); err != nil {
+ panic(err)
+ }
+ for _, s := range lst.Items {
+ if strings.Contains(s.Name, "camel-k") && conditions(s) {
+ return &s
+ }
+ }
+ return nil
+ }
+}
+
+func clusterServiceVersionPhase(conditions func(olm.ClusterServiceVersion) bool, ns string) func() olm.ClusterServiceVersionPhase {
+ return func() olm.ClusterServiceVersionPhase {
+ if csv := clusterServiceVersion(conditions, ns)(); csv != nil && unsafe.Sizeof(csv.Status) > 0 {
+ return csv.Status.Phase
+ }
+ return ""
+ }
+}
+
+func catalogSource(ns, name string) func() *olm.CatalogSource {
+ return func() *olm.CatalogSource {
+ cs := &olm.CatalogSource{
+ TypeMeta: metav1.TypeMeta{
+ Kind: "CatalogSource",
+ APIVersion: olm.SchemeGroupVersion.String(),
+ },
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: ns,
+ Name: name,
+ },
+ }
+ if err := TestClient().Get(TestContext, ctrl.ObjectKeyFromObject(cs), cs); err != nil && errors.IsNotFound(err) {
+ return nil
+ } else if err != nil {
+ log.Errorf(err, "Error while retrieving CatalogSource %s", name)
+ return nil
+ }
+ return cs
+ }
+}
+
+func catalogSourcePhase(ns, name string) func() string {
+ return func() string {
+ if source := catalogSource(ns, name)(); source != nil && source.Status.GRPCConnectionState != nil {
+ return catalogSource(ns, name)().Status.GRPCConnectionState.LastObservedState
+ }
+ return ""
+ }
+}
[camel-k] 08/09: chore(e2e): List Builds when dumping Namespace
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit e25ac1c7bf42bd20a16aee270c4993dfbf8716ad
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed May 12 10:06:19 2021 +0200
chore(e2e): List Builds when dumping Namespace
---
e2e/support/util/dump.go | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/e2e/support/util/dump.go b/e2e/support/util/dump.go
index 8a456ad..f31ba9c 100644
--- a/e2e/support/util/dump.go
+++ b/e2e/support/util/dump.go
@@ -35,7 +35,6 @@ import (
// Dump prints all information about the given namespace to debug errors
func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error {
-
t.Logf("-------------------- start dumping namespace %s --------------------\n", ns)
camelClient, err := versioned.NewForConfig(c.GetConfig())
@@ -84,6 +83,19 @@ func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error {
t.Logf("---\n%s\n---\n", string(pdata))
}
+ builds, err := camelClient.CamelV1().Builds(ns).List(ctx, metav1.ListOptions{})
+ if err != nil {
+ return err
+ }
+ t.Logf("Found %d Builds:\n", len(builds.Items))
+ for _, build := range builds.Items {
+ data, err := kubernetes.ToYAML(&build)
+ if err != nil {
+ return err
+ }
+ t.Logf("---\n%s\n---\n", string(data))
+ }
+
cms, err := c.CoreV1().ConfigMaps(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
[camel-k] 02/09: fix(e2e): Patch the OLM bundle CSV with replaces
field
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit f167ac6c8fd02a38e5160adef38b6cea4770e3a3
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue May 11 13:59:20 2021 +0200
fix(e2e): Patch the OLM bundle CSV with replaces field
---
.github/workflows/upgrade.yml | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 25452a2..3e56b03 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -125,17 +125,15 @@ jobs:
# replace image
$(cd config/manifests && kustomize edit set image "docker.io/apache/camel-k=${{ env.LOCAL_IMAGE }}")
-
- # CSV the patch to force OLM upgrade
- export RELEASE_VERSION=$(make get-version | grep -Po "\d.\d.\d")
+ # Patch CSV with the 'replaces' field to define the upgrade graph
cat <<EOF > config/manifests/patch.yml
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
namespace: placeholder
name: camel-k.v$(make get-last-released-version)
- annotations:
- olm.skipRange: ">=1.0.0 <${RELEASE_VERSION}"
+ spec:
+ replaces: camel-k-operator.v$(make get-last-released-version)
EOF
echo "Patching CSV with"
@@ -150,7 +148,7 @@ jobs:
run: |
export LOCAL_IIB=$KIND_REGISTRY/apache/camel-k-iib:$(make get-version)
echo "LOCAL_IIB=${LOCAL_IIB}" >> $GITHUB_ENV
- opm index add --bundles ${{ env.LOCAL_IMAGE_BUNDLE }} -u docker --from-index quay.io/operatorhubio/catalog:latest --tag ${LOCAL_IIB} --skip-tls
+ opm index add --bundles ${{ env.LOCAL_IMAGE_BUNDLE }} -c docker --from-index quay.io/operatorhubio/catalog:latest --tag ${LOCAL_IIB} --skip-tls
docker push ${LOCAL_IIB}
- name: Run IT
run: |
[camel-k] 05/09: chore(e2e): Remove CRDs after OLM uninstall
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 0cc0e632044c032708499ee9bb5b82758c2cb3ba
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue May 11 15:15:37 2021 +0200
chore(e2e): Remove CRDs after OLM uninstall
---
e2e/upgrade/cli_upgrade_test.go | 3 ---
e2e/upgrade/olm_upgrade_test.go | 2 ++
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/e2e/upgrade/cli_upgrade_test.go b/e2e/upgrade/cli_upgrade_test.go
index 095943e..55bed82 100644
--- a/e2e/upgrade/cli_upgrade_test.go
+++ b/e2e/upgrade/cli_upgrade_test.go
@@ -36,9 +36,6 @@ import (
)
func TestOperatorUpgrade(t *testing.T) {
- // Clean all cluster-wide resources that could corrupt the test run
- Expect(Kamel("uninstall", "--all", "--olm=false").Execute()).To(Succeed())
-
WithNewTestNamespace(t, func(ns string) {
version, ok := os.LookupEnv("KAMEL_K_TEST_RELEASE_VERSION")
Expect(ok).To(BeTrue())
diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go
index 21f6237..3a3bc8d 100644
--- a/e2e/upgrade/olm_upgrade_test.go
+++ b/e2e/upgrade/olm_upgrade_test.go
@@ -142,6 +142,8 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
// Clean up
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
Expect(Kamel("uninstall", "-n", ns).Execute()).To(Succeed())
+ // Clean up cluster-wide resources that are not removed by OLM
+ Expect(Kamel("uninstall", "--all", "--olm=false").Execute()).To(Succeed())
})
})
}
[camel-k] 01/09: fix(ci): Use Docker to build OLM index image
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 0a156fabd331d1714c2b4e08ee7a1912336840de
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Apr 27 14:24:14 2021 +0200
fix(ci): Use Docker to build OLM index image
---
.github/workflows/upgrade.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index ee99630..25452a2 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -150,8 +150,8 @@ jobs:
run: |
export LOCAL_IIB=$KIND_REGISTRY/apache/camel-k-iib:$(make get-version)
echo "LOCAL_IIB=${LOCAL_IIB}" >> $GITHUB_ENV
- opm index add --bundles ${{ env.LOCAL_IMAGE_BUNDLE }} --from-index quay.io/operatorhubio/catalog:latest --tag ${LOCAL_IIB} --skip-tls
- podman push --tls-verify=false ${LOCAL_IIB}
+ opm index add --bundles ${{ env.LOCAL_IMAGE_BUNDLE }} -u docker --from-index quay.io/operatorhubio/catalog:latest --tag ${LOCAL_IIB} --skip-tls
+ docker push ${LOCAL_IIB}
- name: Run IT
run: |
# Use the last released Kamel CLI
[camel-k] 03/09: fix(e2e): Use correct OLM bundle CSV name in
Kustomize patch
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 94f54139708ab6c06682b8461111aa0bd2e7c3de
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue May 11 14:00:04 2021 +0200
fix(e2e): Use correct OLM bundle CSV name in Kustomize patch
---
.github/workflows/upgrade.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 3e56b03..0de7b5b 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -131,7 +131,7 @@ jobs:
kind: ClusterServiceVersion
metadata:
namespace: placeholder
- name: camel-k.v$(make get-last-released-version)
+ name: camel-k.v$(make get-version | grep -Po "\d.\d.\d")
spec:
replaces: camel-k-operator.v$(make get-last-released-version)
EOF
[camel-k] 07/09: chore(e2e): Assert upgraded integration Pod uses
new version Kit
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 10b35ece5b550e85ea4ad301fe57bdf3f04cd496
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed May 12 10:06:12 2021 +0200
chore(e2e): Assert upgraded integration Pod uses new version Kit
---
e2e/support/test_support.go | 34 +++++++++++++++++++++-------------
e2e/upgrade/cli_upgrade_test.go | 33 +++++++++++++++++++++++++--------
e2e/upgrade/olm_upgrade_test.go | 30 +++++++++++++++++++++++++-----
3 files changed, 71 insertions(+), 26 deletions(-)
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index a65ca10..cdc0998 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -575,25 +575,33 @@ func ScaleIntegration(ns string, name string, replicas int32) error {
})
}
-func Kits(ns string) func() []v1.IntegrationKit {
+func Kits(ns string, filters ...func(*v1.IntegrationKit) bool) func() []v1.IntegrationKit {
return func() []v1.IntegrationKit {
- lst := v1.NewIntegrationKitList()
- if err := TestClient().List(TestContext, &lst, ctrl.InNamespace(ns)); err != nil {
+ list := v1.NewIntegrationKitList()
+ if err := TestClient().List(TestContext, &list, ctrl.InNamespace(ns)); err != nil {
panic(err)
}
- return lst.Items
- }
-}
-func KitsWithVersion(ns string, version string) func() int {
- return func() int {
- count := 0
- for _, k := range Kits(ns)() {
- if k.Status.Version == version {
- count++
+ if len(filters) == 0 {
+ filters = []func(*v1.IntegrationKit) bool{
+ func(kit *v1.IntegrationKit) bool {
+ return true
+ },
}
}
- return count
+
+ var kits []v1.IntegrationKit
+ kits:
+ for _, kit := range list.Items {
+ for _, filter := range filters {
+ if !filter(&kit) {
+ continue kits
+ }
+ }
+ kits = append(kits, kit)
+ }
+
+ return kits
}
}
diff --git a/e2e/upgrade/cli_upgrade_test.go b/e2e/upgrade/cli_upgrade_test.go
index 55bed82..b324633 100644
--- a/e2e/upgrade/cli_upgrade_test.go
+++ b/e2e/upgrade/cli_upgrade_test.go
@@ -66,15 +66,14 @@ func TestOperatorUpgrade(t *testing.T) {
Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+
// Check the Integration version
Eventually(IntegrationVersion(ns, name)).Should(Equal(version))
- kit := IntegrationKit(ns, name)()
// Clear the KAMEL_BIN environment variable so that the current version is used from now on
Expect(os.Setenv("KAMEL_BIN", "")).To(Succeed())
// Upgrade the operator by installing the current version
- // FIXME: it seems forcing the installation does not re-install the CRDs
Expect(Kamel("install", "--olm=false", "--cluster-setup", "--force").Execute()).To(Succeed())
Expect(Kamel("install", "-n", ns, "--olm=false", "--force", "--operator-image", image).Execute()).To(Succeed())
@@ -86,19 +85,29 @@ func TestOperatorUpgrade(t *testing.T) {
Eventually(PlatformVersion(ns), TestTimeoutMedium).Should(Equal(defaults.Version))
// Check the Integration hasn't been upgraded
- Consistently(IntegrationVersion(ns, name), 3*time.Second).Should(Equal(version))
+ Consistently(IntegrationVersion(ns, name), 5*time.Second, 1*time.Second).Should(Equal(version))
// Force the Integration upgrade
Expect(Kamel("rebuild", name, "-n", ns).Execute()).To(Succeed())
- // Check the Integration version change
+ // Check the Integration version has been upgraded
Eventually(IntegrationVersion(ns, name)).Should(Equal(defaults.Version))
+
// Check the previous kit is not garbage collected
- Eventually(KitsWithVersion(ns, version)).Should(Equal(1))
+ Eventually(Kits(ns, kitWithVersion(version))).Should(HaveLen(1))
// Check a new kit is created with the current version
- Eventually(KitsWithVersion(ns, defaults.Version)).Should(Equal(1))
- // Check the Integration uses the new kit
- Eventually(IntegrationKit(ns, name), TestTimeoutMedium).ShouldNot(Equal(kit))
+ Eventually(Kits(ns, kitWithVersion(defaults.Version))).Should(HaveLen(1))
+ // Check the new kit is ready
+ Eventually(Kits(ns, kitWithVersion(defaults.Version), kitWithPhase(v1.IntegrationKitPhaseReady)),
+ TestTimeoutMedium).Should(HaveLen(1))
+
+ kit := Kits(ns, kitWithVersion(defaults.Version))()[0]
+
+ // Check the Integration uses the new image
+ Eventually(IntegrationKit(ns, name), TestTimeoutMedium).Should(Equal(kit.Name))
+ // Check the Integration Pod uses the new kit
+ Eventually(IntegrationPodImage(ns, name)).Should(Equal(kit.Status.Image))
+
// Check the Integration runs correctly
Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
@@ -108,3 +117,11 @@ func TestOperatorUpgrade(t *testing.T) {
Expect(Kamel("uninstall", "--all", "--olm=false").Execute()).To(Succeed())
})
}
+
+func kitWithVersion(version string) func(kit *v1.IntegrationKit) bool {
+ return func(kit *v1.IntegrationKit) bool { return kit.Status.Version == version }
+}
+
+func kitWithPhase(phase v1.IntegrationKitPhase) func(kit *v1.IntegrationKit) bool {
+ return func(kit *v1.IntegrationKit) bool { return kit.Status.Phase == phase }
+}
diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go
index 3a3bc8d..5641959 100644
--- a/e2e/upgrade/olm_upgrade_test.go
+++ b/e2e/upgrade/olm_upgrade_test.go
@@ -25,6 +25,7 @@ import (
"fmt"
"os"
"testing"
+ "time"
. "github.com/onsi/gomega"
@@ -38,6 +39,7 @@ import (
. "github.com/apache/camel-k/e2e/support"
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+ "github.com/apache/camel-k/pkg/util/defaults"
)
const catalogSourceName = "test-camel-k-source"
@@ -88,9 +90,10 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
name := "yaml"
Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
// Check the Integration runs correctly
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+
// Check the Integration version matches that of the current operator
Expect(IntegrationVersion(ns, name)()).To(ContainSubstring(prevIPVersionPrefix))
@@ -128,16 +131,33 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
// Clear the KAMEL_BIN environment variable so that the current version is used from now on
Expect(os.Setenv("KAMEL_BIN", "")).To(Succeed())
- // Check the Integration is still running the old version
- Expect(IntegrationVersion(ns, name)()).To(ContainSubstring(prevIPVersionPrefix))
+ // Check the Integration hasn't been upgraded
+ Consistently(IntegrationVersion(ns, name), 5*time.Second, 1*time.Second).Should(ContainSubstring(prevIPVersionPrefix))
// Rebuild the Integration
Expect(Kamel("rebuild", name, "-n", ns).Execute()).To(Succeed())
+ // Check the Integration version has been upgraded
+ Eventually(IntegrationVersion(ns, name)).Should(ContainSubstring(newIPVersionPrefix))
+
+ // Check the previous kit is not garbage collected
+ Eventually(Kits(ns, kitWithVersion(prevCSVVersion.String()))).Should(HaveLen(1))
+ // Check a new kit is created with the current version
+ Eventually(Kits(ns, kitWithVersion(defaults.Version))).Should(HaveLen(1))
+ // Check the new kit is ready
+ Eventually(Kits(ns, kitWithVersion(defaults.Version), kitWithPhase(v1.IntegrationKitPhaseReady)),
+ TestTimeoutMedium).Should(HaveLen(1))
+
+ kit := Kits(ns, kitWithVersion(defaults.Version))()[0]
+
+ // Check the Integration uses the new kit
+ Eventually(IntegrationKit(ns, name), TestTimeoutMedium).Should(Equal(kit.Name))
+ // Check the Integration Pod uses the new image
+ Eventually(IntegrationPodImage(ns, name)).Should(Equal(kit.Status.Image))
+
// Check the Integration runs correctly
Eventually(IntegrationPodPhase(ns, name)).Should(Equal(corev1.PodRunning))
- // Check the Integration has upgraded
- Eventually(IntegrationVersion(ns, name), TestTimeoutMedium).Should(ContainSubstring(newIPVersionPrefix))
+ Eventually(IntegrationCondition(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
// Clean up
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
[camel-k] 06/09: chore(e2e): Remove obsolete operator upgrade e2e
test
Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch release-1.4.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit f5d049f404805e7b7c661c3918bb488cae131195
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue May 11 18:43:23 2021 +0200
chore(e2e): Remove obsolete operator upgrade e2e test
---
e2e/common/upgrade_test.go | 55 ----------------------------------------------
1 file changed, 55 deletions(-)
diff --git a/e2e/common/upgrade_test.go b/e2e/common/upgrade_test.go
deleted file mode 100644
index ede3a0c..0000000
--- a/e2e/common/upgrade_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// +build integration
-
-// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
-
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package common
-
-import (
- "testing"
- "time"
-
- . "github.com/onsi/gomega"
-
- . "github.com/apache/camel-k/e2e/support"
- "github.com/apache/camel-k/pkg/util/defaults"
-)
-
-func TestPlatformUpgrade(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
- Eventually(OperatorPod(ns)).ShouldNot(BeNil())
- Eventually(PlatformVersion(ns)).Should(Equal(defaults.Version))
-
- // Scale the operator down to zero
- Eventually(ScaleOperator(ns, 0), 10*time.Second).Should(BeNil())
- Eventually(OperatorPod(ns)).Should(BeNil())
-
- // Change the version to an older one
- Eventually(SetPlatformVersion(ns, "an.older.one")).Should(Succeed())
- Eventually(PlatformVersion(ns)).Should(Equal("an.older.one"))
-
- // Scale the operator up
- Eventually(ScaleOperator(ns, 1)).Should(BeNil())
- Eventually(OperatorPod(ns)).ShouldNot(BeNil())
-
- // Check the platform version change
- Eventually(PlatformVersion(ns)).Should(Equal(defaults.Version))
- })
-}