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/02/22 16:18:38 UTC
[camel-k] branch master updated: chore(e2e): Polish Gomega usage in
e2e tests
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push:
new bf8cdc7 chore(e2e): Polish Gomega usage in e2e tests
bf8cdc7 is described below
commit bf8cdc73874faad5f02ee0fab828245153ccb28e
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Mon Feb 22 12:43:14 2021 +0100
chore(e2e): Polish Gomega usage in e2e tests
---
e2e/builder/build_test.go | 7 +--
e2e/builder/docker_hub_test.go | 11 +++--
e2e/builder/github_packages_test.go | 13 ++---
e2e/builder/global_test.go | 26 +++++-----
e2e/common/client_test.go | 9 ++--
e2e/common/cron_test.go | 33 +++++--------
e2e/common/dev_mode_test.go | 7 ++-
e2e/common/global_kamelet_test.go | 18 +++----
e2e/common/install_test.go | 13 ++---
e2e/common/languages/groovy_test.go | 14 +++---
e2e/common/languages/init_test_support.go | 13 ++---
e2e/common/languages/java_test.go | 19 ++++----
e2e/common/languages/js_test.go | 15 +++---
e2e/common/languages/kotlin_test.go | 15 +++---
e2e/common/languages/polyglot_test.go | 15 +++---
e2e/common/languages/xml_test.go | 14 +++---
e2e/common/languages/yaml_test.go | 19 ++++----
e2e/common/offline_commands_test.go | 3 +-
e2e/common/platformless_run_test.go | 14 +++---
e2e/common/rest_test.go | 14 +++---
e2e/common/run_test.go | 24 ++++------
e2e/common/scale_test.go | 31 +++++-------
e2e/common/tekton_test.go | 11 +++--
e2e/common/traits/affinity_test.go | 40 ++++++++--------
e2e/common/traits/istio_test.go | 18 +++----
e2e/common/traits/jolokia_test.go | 19 ++++----
e2e/common/traits/master_test.go | 20 ++++----
e2e/common/traits/pdb_test.go | 10 ++--
e2e/common/traits/prometheus_test.go | 18 +++----
e2e/common/traits/pull_secret_test.go | 36 +++++++-------
e2e/common/uninstall_test.go | 28 +++++------
e2e/common/upgrade_test.go | 20 ++++----
e2e/knative/kamelet_test.go | 23 +++++----
e2e/knative/knative_platform_test.go | 17 +++----
e2e/knative/knative_test.go | 80 +++++++++++++++----------------
e2e/knative/openapi_test.go | 18 +++----
e2e/local/local_run_test.go | 5 +-
e2e/resources/resources_test.go | 19 ++++----
38 files changed, 359 insertions(+), 370 deletions(-)
diff --git a/e2e/builder/build_test.go b/e2e/builder/build_test.go
index 4b2ad8b..737647e 100644
--- a/e2e/builder/build_test.go
+++ b/e2e/builder/build_test.go
@@ -24,9 +24,10 @@ package builder
import (
"testing"
+ . "github.com/onsi/gomega"
+
. "github.com/apache/camel-k/e2e/support"
"github.com/apache/camel-k/pkg/apis/camel/v1"
- . "github.com/onsi/gomega"
)
func TestKitTimerToLogFullBuild(t *testing.T) {
@@ -39,12 +40,12 @@ func TestKitKnativeFullBuild(t *testing.T) {
func doKitFullBuild(t *testing.T, name string, dependencies ...string) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
buildKitArgs := []string{"kit", "create", name, "-n", ns}
for _, dep := range dependencies {
buildKitArgs = append(buildKitArgs, "-d", dep)
}
- Expect(Kamel(buildKitArgs...).Execute()).Should(BeNil())
+ Expect(Kamel(buildKitArgs...).Execute()).To(Succeed())
Eventually(Build(ns, name)).ShouldNot(BeNil())
Eventually(func() v1.BuildPhase {
return Build(ns, name)().Status.Phase
diff --git a/e2e/builder/docker_hub_test.go b/e2e/builder/docker_hub_test.go
index 2f11e2f..5d167d0 100644
--- a/e2e/builder/docker_hub_test.go
+++ b/e2e/builder/docker_hub_test.go
@@ -25,9 +25,11 @@ import (
"os"
"testing"
- . "github.com/apache/camel-k/e2e/support"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
)
func TestRunWithDockerHubRegistry(t *testing.T) {
@@ -44,15 +46,14 @@ func TestRunWithDockerHubRegistry(t *testing.T) {
"--registry-auth-username", user,
"--registry-auth-password", pass,
"--cluster-type", "kubernetes").
- Execute()).Should(BeNil())
+ Execute()).To(Succeed())
- Expect(Kamel("run", "-n", ns, "files/groovy.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/groovy.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "groovy"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
Eventually(IntegrationPodImage(ns, "groovy"), TestTimeoutShort).Should(HavePrefix("docker.io"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
-
}
diff --git a/e2e/builder/github_packages_test.go b/e2e/builder/github_packages_test.go
index df257ed..ae4d1e7 100644
--- a/e2e/builder/github_packages_test.go
+++ b/e2e/builder/github_packages_test.go
@@ -25,9 +25,11 @@ import (
"os"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- . "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
+
+ . "github.com/onsi/gomega"
+
+ . "github.com/apache/camel-k/e2e/support"
)
func TestRunWithGithubPackagesRegistry(t *testing.T) {
@@ -45,15 +47,14 @@ func TestRunWithGithubPackagesRegistry(t *testing.T) {
"--registry-auth-username", user,
"--registry-auth-password", pass,
"--cluster-type", "kubernetes").
- Execute()).Should(BeNil())
+ Execute()).To(Succeed())
- Expect(Kamel("run", "-n", ns, "files/groovy.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/groovy.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "groovy"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
Eventually(IntegrationPodImage(ns, "groovy"), TestTimeoutShort).Should(HavePrefix("docker.pkg.github.com"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
-
}
diff --git a/e2e/builder/global_test.go b/e2e/builder/global_test.go
index 8490e47..1e2650b 100644
--- a/e2e/builder/global_test.go
+++ b/e2e/builder/global_test.go
@@ -25,12 +25,14 @@ import (
"os"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- "github.com/apache/camel-k/pkg/platform"
- "github.com/apache/camel-k/pkg/util/openshift"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ "github.com/apache/camel-k/pkg/platform"
+ "github.com/apache/camel-k/pkg/util/openshift"
)
func TestRunGlobalInstall(t *testing.T) {
@@ -45,34 +47,34 @@ func TestRunGlobalInstall(t *testing.T) {
}
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns, "--global").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--global").Execute()).To(Succeed())
// NS2: namespace without operator
WithNewTestNamespace(t, func(ns2 string) {
- Expect(Kamel("install", "-n", ns2, "--skip-operator-setup", "--olm=false").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns2, "--skip-operator-setup", "--olm=false").Execute()).To(Succeed())
- Expect(Kamel("run", "-n", ns2, "files/Java.java").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns2, "files/Java.java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns2, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns2, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns2).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns2).Execute()).To(Succeed())
- Expect(ConfigMap(ns2, platform.OperatorLockName)()).Should(BeNil(), "No locking configmap expected")
+ Expect(ConfigMap(ns2, platform.OperatorLockName)()).To(BeNil(), "No locking configmap expected")
})
// NS3: namespace with its own operator
WithNewTestNamespace(t, func(ns3 string) {
- Expect(Kamel("install", "-n", ns3, "--olm=false").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns3, "--olm=false").Execute()).To(Succeed())
- Expect(Kamel("run", "-n", ns3, "files/Java.java").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns3, "files/Java.java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns3, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns3, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns3).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns3).Execute()).To(Succeed())
Expect(ConfigMap(ns3, platform.OperatorLockName)()).ShouldNot(BeNil(),
"OperatorSDK is expected to use configmaps for locking: if this changes (e.g. using Leases) we should update our guard logic",
)
})
- Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles").Execute()).Should(BeNil())
+ Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles").Execute()).To(Succeed())
})
}
diff --git a/e2e/common/client_test.go b/e2e/common/client_test.go
index 3a5e2e4..ee054a1 100644
--- a/e2e/common/client_test.go
+++ b/e2e/common/client_test.go
@@ -24,12 +24,15 @@ package common
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- "github.com/apache/camel-k/pkg/apis/camel/v1"
- "github.com/apache/camel-k/pkg/client/camel/clientset/versioned"
"github.com/stretchr/testify/assert"
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
"sigs.k8s.io/controller-runtime/pkg/client/config"
+
+ . "github.com/apache/camel-k/e2e/support"
+ "github.com/apache/camel-k/pkg/apis/camel/v1"
+ "github.com/apache/camel-k/pkg/client/camel/clientset/versioned"
)
func TestClientFunctionalities(t *testing.T) {
diff --git a/e2e/common/cron_test.go b/e2e/common/cron_test.go
index acc9369..9759334 100644
--- a/e2e/common/cron_test.go
+++ b/e2e/common/cron_test.go
@@ -24,55 +24,48 @@ package common
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunCronExample(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("cron", func(t *testing.T) {
- RegisterTestingT(t)
-
- Expect(Kamel("run", "-n", ns, "files/cron.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/cron.groovy").Execute()).To(Succeed())
Eventually(IntegrationCronJob(ns, "cron"), TestTimeoutMedium).ShouldNot(BeNil())
Eventually(IntegrationCondition(ns, "cron", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "cron"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("cron-timer", func(t *testing.T) {
- RegisterTestingT(t)
-
- Expect(Kamel("run", "-n", ns, "files/cron-timer.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/cron-timer.groovy").Execute()).To(Succeed())
Eventually(IntegrationCronJob(ns, "cron-timer"), TestTimeoutMedium).ShouldNot(BeNil())
Eventually(IntegrationCondition(ns, "cron-timer", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "cron-timer"), TestTimeoutMedium).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("cron-fallback", func(t *testing.T) {
- RegisterTestingT(t)
-
- Expect(Kamel("run", "-n", ns, "files/cron-fallback.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/cron-fallback.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "cron-fallback"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "cron-fallback", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "cron-fallback"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
- // Requires fix to https://github.com/apache/camel-k-runtime/issues/346
t.Run("cron-quartz", func(t *testing.T) {
- RegisterTestingT(t)
-
- Expect(Kamel("run", "-n", ns, "files/cron-quartz.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/cron-quartz.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "cron-quartz"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "cron-quartz", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "cron-quartz"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
diff --git a/e2e/common/dev_mode_test.go b/e2e/common/dev_mode_test.go
index 6c34de7..fef9153 100644
--- a/e2e/common/dev_mode_test.go
+++ b/e2e/common/dev_mode_test.go
@@ -27,17 +27,17 @@ import (
"os"
"testing"
+ . "github.com/onsi/gomega"
+
. "github.com/apache/camel-k/e2e/support"
"github.com/apache/camel-k/e2e/support/util"
- . "github.com/onsi/gomega"
)
func TestRunDevMode(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run yaml dev mode", func(t *testing.T) {
- RegisterTestingT(t)
ctx, cancel := context.WithCancel(TestContext)
defer cancel()
piper, pipew := io.Pipe()
@@ -65,7 +65,6 @@ func TestRunDevMode(t *testing.T) {
})
t.Run("run yaml remote dev mode", func(t *testing.T) {
- RegisterTestingT(t)
ctx, cancel := context.WithCancel(TestContext)
defer cancel()
piper, pipew := io.Pipe()
diff --git a/e2e/common/global_kamelet_test.go b/e2e/common/global_kamelet_test.go
index f3db50a..1cbdb92 100644
--- a/e2e/common/global_kamelet_test.go
+++ b/e2e/common/global_kamelet_test.go
@@ -25,11 +25,13 @@ import (
"os"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- "github.com/apache/camel-k/pkg/util/openshift"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ "github.com/apache/camel-k/pkg/util/openshift"
)
func TestRunGlobalKamelet(t *testing.T) {
@@ -44,20 +46,20 @@ func TestRunGlobalKamelet(t *testing.T) {
}
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns, "--global").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--global").Execute()).To(Succeed())
- Expect(CreateTimerKamelet(ns, "my-own-timer-source")()).Should(BeNil())
+ Expect(CreateTimerKamelet(ns, "my-own-timer-source")()).To(Succeed())
// NS2: namespace without operator
WithNewTestNamespace(t, func(ns2 string) {
- Expect(Kamel("install", "-n", ns2, "--skip-operator-setup", "--olm=false").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns2, "--skip-operator-setup", "--olm=false").Execute()).To(Succeed())
- Expect(Kamel("run", "-n", ns2, "files/timer-kamelet-usage.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns2, "files/timer-kamelet-usage.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns2, "timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns2, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world"))
- Expect(Kamel("delete", "--all", "-n", ns2).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns2).Execute()).To(Succeed())
})
- Expect(Kamel("uninstall", "-n", ns, "--skip-cluster-roles=false", "--skip-cluster-role-bindings=false").Execute()).Should(BeNil())
+ Expect(Kamel("uninstall", "-n", ns, "--skip-cluster-roles=false", "--skip-cluster-role-bindings=false").Execute()).To(Succeed())
})
}
diff --git a/e2e/common/install_test.go b/e2e/common/install_test.go
index 805477a..db22db5 100644
--- a/e2e/common/install_test.go
+++ b/e2e/common/install_test.go
@@ -24,35 +24,36 @@ package common
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
. "github.com/onsi/gomega"
+
+ . "github.com/apache/camel-k/e2e/support"
)
func TestBasicInstallation(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
})
}
func TestAlternativeImageInstallation(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns, "--operator-image", "x/y:latest").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--operator-image", "x/y:latest").Execute()).To(Succeed())
Eventually(OperatorImage(ns)).Should(Equal("x/y:latest"))
})
}
func TestKitMainInstallation(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
- Expect(Kamel("kit", "create", "timer", "-d", "camel:timer", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
+ Expect(Kamel("kit", "create", "timer", "-d", "camel:timer", "-n", ns).Execute()).To(Succeed())
Eventually(Build(ns, "timer")).ShouldNot(BeNil())
})
}
func TestMavenRepositoryInstallation(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns, "--maven-repository", "https://my.repo.org/public/").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--maven-repository", "https://my.repo.org/public/").Execute()).To(Succeed())
Eventually(Configmap(ns, "camel-k-maven-settings")).Should(Not(BeNil()))
Eventually(func() string {
return Configmap(ns, "camel-k-maven-settings")().Data["settings.xml"]
diff --git a/e2e/common/languages/groovy_test.go b/e2e/common/languages/groovy_test.go
index 1923e21..a09b365 100644
--- a/e2e/common/languages/groovy_test.go
+++ b/e2e/common/languages/groovy_test.go
@@ -24,24 +24,24 @@ package languages
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunSimpleGroovyExamples(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run groovy", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "../files/groovy.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "../files/groovy.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "groovy"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "groovy", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("init run groovy", func(t *testing.T) {
diff --git a/e2e/common/languages/init_test_support.go b/e2e/common/languages/init_test_support.go
index 0dcb841..43cc2c0 100644
--- a/e2e/common/languages/init_test_support.go
+++ b/e2e/common/languages/init_test_support.go
@@ -26,24 +26,25 @@ import (
"path"
"testing"
+ . "github.com/onsi/gomega"
+
+ v1 "k8s.io/api/core/v1"
+
. "github.com/apache/camel-k/e2e/support"
"github.com/apache/camel-k/e2e/support/util"
camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
- . "github.com/onsi/gomega"
- v1 "k8s.io/api/core/v1"
)
func RunInitGeneratedExample(lang camelv1.Language, ns string, t *testing.T) {
- RegisterTestingT(t)
dir := util.MakeTempDir(t)
itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava
fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java
file := path.Join(dir, fileName)
- Expect(Kamel("init", file).Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, file).Execute()).Should(BeNil())
+ Expect(Kamel("init", file).Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, file).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, itName), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang)))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
}
func languageInitExpectedString(lang camelv1.Language) string {
diff --git a/e2e/common/languages/java_test.go b/e2e/common/languages/java_test.go
index 1571060..784b1b3 100644
--- a/e2e/common/languages/java_test.go
+++ b/e2e/common/languages/java_test.go
@@ -24,33 +24,32 @@ package languages
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunSimpleJavaExamples(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run java", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "../files/Java.java").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "../files/Java.java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run java with properties", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "../files/Prop.java", "--property-file", "../files/prop.properties").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "../files/Prop.java", "--property-file", "../files/prop.properties").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "prop"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "prop", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "prop"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("init run java", func(t *testing.T) {
diff --git a/e2e/common/languages/js_test.go b/e2e/common/languages/js_test.go
index 052ba50..e857b4a 100644
--- a/e2e/common/languages/js_test.go
+++ b/e2e/common/languages/js_test.go
@@ -24,29 +24,28 @@ package languages
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunSimpleJavaScriptExamples(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run js", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "../files/js.js").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "../files/js.js").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "js"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "js", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "js"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("init run JavaScript", func(t *testing.T) {
RunInitGeneratedExample(camelv1.LanguageJavaScript, ns, t)
})
-
})
}
diff --git a/e2e/common/languages/kotlin_test.go b/e2e/common/languages/kotlin_test.go
index d1c5c7f..0e97f95 100644
--- a/e2e/common/languages/kotlin_test.go
+++ b/e2e/common/languages/kotlin_test.go
@@ -24,29 +24,28 @@ package languages
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunSimpleKotlinExamples(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run kotlin", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "../files/kotlin.kts").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "../files/kotlin.kts").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "kotlin"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "kotlin", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "kotlin"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("init run Kotlin", func(t *testing.T) {
RunInitGeneratedExample(camelv1.LanguageKotlin, ns, t)
})
-
})
}
diff --git a/e2e/common/languages/polyglot_test.go b/e2e/common/languages/polyglot_test.go
index e1c439f..8c520e6 100644
--- a/e2e/common/languages/polyglot_test.go
+++ b/e2e/common/languages/polyglot_test.go
@@ -24,26 +24,25 @@ package languages
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunPolyglotExamples(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run polyglot", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "--name", "polyglot", "../files/js-polyglot.js", "../files/yaml-polyglot.yaml").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "--name", "polyglot", "../files/js-polyglot.js", "../files/yaml-polyglot.yaml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "polyglot"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "polyglot", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-yaml"))
Eventually(IntegrationLogs(ns, "polyglot"), TestTimeoutShort).Should(ContainSubstring("Magicpolyglot-js"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
-
})
}
diff --git a/e2e/common/languages/xml_test.go b/e2e/common/languages/xml_test.go
index d8e4f9a..c1b0fc9 100644
--- a/e2e/common/languages/xml_test.go
+++ b/e2e/common/languages/xml_test.go
@@ -24,24 +24,24 @@ package languages
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunSimpleXmlExamples(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run xml", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "../files/xml.xml").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "../files/xml.xml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "xml"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "xml", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "xml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("init run xml", func(t *testing.T) {
diff --git a/e2e/common/languages/yaml_test.go b/e2e/common/languages/yaml_test.go
index 2864557..083e658 100644
--- a/e2e/common/languages/yaml_test.go
+++ b/e2e/common/languages/yaml_test.go
@@ -24,34 +24,33 @@ package languages
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunSimpleYamlExamples(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run yaml", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "../files/yaml.yaml").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "../files/yaml.yaml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "yaml", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run yaml Quarkus", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "--name", "yaml-quarkus", "../files/yaml.yaml", "-t", "quarkus.enabled=true").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "--name", "yaml-quarkus", "../files/yaml.yaml", "-t", "quarkus.enabled=true").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "yaml-quarkus"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "yaml-quarkus", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "yaml-quarkus"), TestTimeoutShort).Should(ContainSubstring("powered by Quarkus"))
Eventually(IntegrationLogs(ns, "yaml-quarkus"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("init run yaml", func(t *testing.T) {
diff --git a/e2e/common/offline_commands_test.go b/e2e/common/offline_commands_test.go
index 74956ce..25028bf 100644
--- a/e2e/common/offline_commands_test.go
+++ b/e2e/common/offline_commands_test.go
@@ -25,8 +25,9 @@ import (
"io/ioutil"
"testing"
- . "github.com/apache/camel-k/e2e/support"
"github.com/stretchr/testify/assert"
+
+ . "github.com/apache/camel-k/e2e/support"
)
func TestKamelVersionWorksOffline(t *testing.T) {
diff --git a/e2e/common/platformless_run_test.go b/e2e/common/platformless_run_test.go
index b35097b..b4dc1c3 100644
--- a/e2e/common/platformless_run_test.go
+++ b/e2e/common/platformless_run_test.go
@@ -25,12 +25,14 @@ import (
"os"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- "github.com/apache/camel-k/pkg/apis/camel/v1"
- "github.com/apache/camel-k/pkg/util/openshift"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
+
corev1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ "github.com/apache/camel-k/pkg/apis/camel/v1"
+ "github.com/apache/camel-k/pkg/util/openshift"
)
func TestPlatformlessRun(t *testing.T) {
@@ -43,18 +45,18 @@ func TestPlatformlessRun(t *testing.T) {
}
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
// Delete the platform from the namespace before running the integration
Eventually(DeletePlatform(ns)).Should(BeTrue())
- Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationLogs(ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// Platform should be recreated
Eventually(Platform(ns)).ShouldNot(BeNil())
Eventually(PlatformProfile(ns)).Should(Equal(v1.TraitProfile("")))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/rest_test.go b/e2e/common/rest_test.go
index 3d2635d..e932dd9 100644
--- a/e2e/common/rest_test.go
+++ b/e2e/common/rest_test.go
@@ -27,14 +27,16 @@ import (
"net/http"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- "github.com/apache/camel-k/pkg/util/openshift"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ "github.com/apache/camel-k/pkg/util/openshift"
)
-func TestRunREST(t *testing.T) {
+func TestRunRest(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
var profile string
ocp, err := openshift.IsOpenShift(TestClient())
@@ -45,15 +47,15 @@ func TestRunREST(t *testing.T) {
profile = "Kubernetes"
}
- Expect(Kamel("install", "-n", ns, "--trait-profile", profile).Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/RestConsumer.java").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", profile).Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/RestConsumer.java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "rest-consumer"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
t.Run("Service works", func(t *testing.T) {
name := "John"
service := Service(ns, "rest-consumer")
Eventually(service, TestTimeoutShort).ShouldNot(BeNil())
- Expect(Kamel("run", "-n", ns, "files/RestProducer.groovy", "-p", "serviceName=rest-consumer", "-p", "name="+name).Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/RestProducer.groovy", "-p", "serviceName=rest-consumer", "-p", "name="+name).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "rest-producer"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "rest-consumer"), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("get %s", name)))
Eventually(IntegrationLogs(ns, "rest-producer"), TestTimeoutShort).Should(ContainSubstring(fmt.Sprintf("%s Doe", name)))
diff --git a/e2e/common/run_test.go b/e2e/common/run_test.go
index de43ee6..0aae23a 100644
--- a/e2e/common/run_test.go
+++ b/e2e/common/run_test.go
@@ -34,49 +34,45 @@ import (
func TestRunExamplesFromGitHub(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run java from GitHub", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "github:apache/camel-k/e2e/common/files/Java.java").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "github:apache/camel-k/e2e/common/files/Java.java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run java from GitHub (RAW)", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "https://raw.githubusercontent.com/apache/camel-k/master/e2e/common/files/Java.java").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "https://raw.githubusercontent.com/apache/camel-k/master/e2e/common/files/Java.java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run from GitHub Gist (ID)", func(t *testing.T) {
name := "github-gist-id"
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "--name", name, "gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "--name", name, "gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run from GitHub Gist (URL)", func(t *testing.T) {
name := "github-gist-url"
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "--name", name, "https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "--name", name, "https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
// Cleanup
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/scale_test.go b/e2e/common/scale_test.go
index 7944c64..d0925dd 100644
--- a/e2e/common/scale_test.go
+++ b/e2e/common/scale_test.go
@@ -26,7 +26,6 @@ import (
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gstruct"
- "github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -44,8 +43,8 @@ import (
func TestIntegrationScale(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
name := "java"
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/Java.java", "--name", name).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
@@ -53,18 +52,16 @@ func TestIntegrationScale(t *testing.T) {
t.Run("Scale integration with polymorphic client", func(t *testing.T) {
// Polymorphic scale client
groupResources, err := restmapper.GetAPIGroupResources(TestClient().Discovery())
- assert.Nil(t, err)
+ Expect(err).To(BeNil())
mapper := restmapper.NewDiscoveryRESTMapper(groupResources)
resolver := scale.NewDiscoveryScaleKindResolver(TestClient().Discovery())
scaleClient, err := scale.NewForConfig(TestClient().GetConfig(), mapper, dynamic.LegacyAPIPathResolverFunc, resolver)
- assert.Nil(t, err)
+ Expect(err).To(BeNil())
// Patch the integration scale subresource
patch := "{\"spec\":{\"replicas\":3}}"
_, err = scaleClient.Scales(ns).Patch(TestContext, camelv1.SchemeGroupVersion.WithResource("integrations"), name, types.MergePatchType, []byte(patch), metav1.PatchOptions{})
- if err != nil {
- t.Fatal(err)
- }
+ Expect(err).To(BeNil())
// Check the Integration scale subresource Spec field
Eventually(IntegrationSpecReplicas(ns, name), TestTimeoutShort).
@@ -78,22 +75,18 @@ func TestIntegrationScale(t *testing.T) {
t.Run("Scale integration with Camel K client", func(t *testing.T) {
camel, err := versioned.NewForConfig(TestClient().GetConfig())
- if err != nil {
- t.Fatal(err)
- }
+ Expect(err).To(BeNil())
// Getter
integrationScale, err := camel.CamelV1().Integrations(ns).GetScale(TestContext, name, metav1.GetOptions{})
- Expect(integrationScale).ShouldNot(BeNil())
- Expect(integrationScale.Spec.Replicas).Should(BeNumerically("==", 3))
- Expect(integrationScale.Status.Replicas).Should(BeNumerically("==", 3))
+ Expect(err).To(BeNil())
+ Expect(integrationScale.Spec.Replicas).To(BeNumerically("==", 3))
+ Expect(integrationScale.Status.Replicas).To(BeNumerically("==", 3))
// Setter
integrationScale.Spec.Replicas = 2
integrationScale, err = camel.CamelV1().Integrations(ns).UpdateScale(TestContext, name, integrationScale, metav1.UpdateOptions{})
- if err != nil {
- t.Fatal(err)
- }
+ Expect(err).To(BeNil())
// Check the Integration scale subresource Spec field
Eventually(IntegrationSpecReplicas(ns, name), TestTimeoutShort).
@@ -109,7 +102,7 @@ func TestIntegrationScale(t *testing.T) {
Expect(UpdateIntegration(ns, name, func(it *camelv1.Integration) {
replicas := int32(1)
it.Spec.Replicas = &replicas
- })).Should(BeNil())
+ })).To(Succeed())
// Check it cascades into the Deployment scale
Eventually(IntegrationPods(ns, name), TestTimeoutMedium).Should(HaveLen(1))
@@ -119,6 +112,6 @@ func TestIntegrationScale(t *testing.T) {
})
// Clean up
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/tekton_test.go b/e2e/common/tekton_test.go
index f9ce39e..2549f76 100644
--- a/e2e/common/tekton_test.go
+++ b/e2e/common/tekton_test.go
@@ -24,20 +24,21 @@ package common
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
. "github.com/onsi/gomega"
+
+ . "github.com/apache/camel-k/e2e/support"
)
// TestTektonLikeBehavior verifies that the kamel binary can be invoked from within the Camel K image.
// This feature is used in Tekton pipelines.
func TestTektonLikeBehavior(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(CreateOperatorServiceAccount(ns)).Should(BeNil())
- Expect(CreateOperatorRole(ns)).Should(BeNil())
- Expect(CreateOperatorRoleBinding(ns)).Should(BeNil())
+ Expect(CreateOperatorServiceAccount(ns)).To(Succeed())
+ Expect(CreateOperatorRole(ns)).To(Succeed())
+ Expect(CreateOperatorRoleBinding(ns)).To(Succeed())
Eventually(OperatorPod(ns)).Should(BeNil())
- Expect(CreateKamelPod(ns, "tekton-task", "install", "--skip-cluster-setup", "--force")).Should(BeNil())
+ Expect(CreateKamelPod(ns, "tekton-task", "install", "--skip-cluster-setup", "--force")).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
})
diff --git a/e2e/common/traits/affinity_test.go b/e2e/common/traits/affinity_test.go
index 5cf0db5..e939aae 100644
--- a/e2e/common/traits/affinity_test.go
+++ b/e2e/common/traits/affinity_test.go
@@ -25,16 +25,18 @@ import (
"fmt"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestAffinityTrait(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
var hostname string
if node, err := selectSchedulableNode(); err == nil {
@@ -46,67 +48,63 @@ func TestAffinityTrait(t *testing.T) {
if hostname != "" {
t.Run("Run Java with node affinity", func(t *testing.T) {
- RegisterTestingT(t)
Expect(Kamel("run", "-n", ns, "../files/Java.java",
"--name", "java1",
"-t", "affinity.enabled=true",
- "-t", fmt.Sprintf("affinity.node-affinity-labels=kubernetes.io/hostname in(%s)", hostname)).Execute()).Should(BeNil())
+ "-t", fmt.Sprintf("affinity.node-affinity-labels=kubernetes.io/hostname in(%s)", hostname)).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java1"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java1", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java1"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
pod := IntegrationPod(ns, "java1")()
- Expect(pod.Spec.Affinity).ShouldNot(BeNil())
- Expect(pod.Spec.Affinity.NodeAffinity).Should(Equal(&v1.NodeAffinity{
+ Expect(pod.Spec.Affinity).NotTo(BeNil())
+ Expect(pod.Spec.Affinity.NodeAffinity).To(Equal(&v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: nodeSelector("kubernetes.io/hostname", v1.NodeSelectorOpIn, hostname),
}))
- Expect(pod.Spec.NodeName).Should(Equal(hostname))
+ Expect(pod.Spec.NodeName).To(Equal(hostname))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
t.Run("Run Java with pod affinity", func(t *testing.T) {
- RegisterTestingT(t)
Expect(Kamel("run", "-n", ns, "../files/Java.java",
"--name", "java2",
"-t", "affinity.enabled=true",
- "-t", "affinity.pod-affinity-labels=camel.apache.org/integration").Execute()).Should(BeNil())
+ "-t", "affinity.pod-affinity-labels=camel.apache.org/integration").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java2"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java2", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java2"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
pod := IntegrationPod(ns, "java2")()
- Expect(pod.Spec.Affinity).ShouldNot(BeNil())
- Expect(pod.Spec.Affinity.PodAffinity).Should(Equal(&v1.PodAffinity{
+ Expect(pod.Spec.Affinity).NotTo(BeNil())
+ Expect(pod.Spec.Affinity.PodAffinity).To(Equal(&v1.PodAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []v1.PodAffinityTerm{
podAffinityTerm("camel.apache.org/integration", metav1.LabelSelectorOpExists, "kubernetes.io/hostname"),
},
}))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Run Java with pod anti affinity", func(t *testing.T) {
- RegisterTestingT(t)
-
Expect(Kamel("run", "-n", ns, "../files/Java.java",
"--name", "java3",
"-t", "affinity.enabled=true",
- "-t", "affinity.pod-anti-affinity-labels=camel.apache.org/integration").Execute()).Should(BeNil())
+ "-t", "affinity.pod-anti-affinity-labels=camel.apache.org/integration").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java3"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java3", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java3"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
pod := IntegrationPod(ns, "java3")()
- Expect(pod.Spec.Affinity).ShouldNot(BeNil())
- Expect(pod.Spec.Affinity.PodAntiAffinity).Should(Equal(&v1.PodAntiAffinity{
+ Expect(pod.Spec.Affinity).NotTo(BeNil())
+ Expect(pod.Spec.Affinity.PodAntiAffinity).To(Equal(&v1.PodAntiAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []v1.PodAffinityTerm{
podAffinityTerm("camel.apache.org/integration", metav1.LabelSelectorOpExists, "kubernetes.io/hostname"),
},
}))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
@@ -121,7 +119,7 @@ func selectSchedulableNode() (*v1.Node, error) {
return &node, nil
}
}
- return nil, fmt.Errorf("No node available")
+ return nil, fmt.Errorf("no node available")
}
func nodeSelector(key string, operator v1.NodeSelectorOperator, value string) *v1.NodeSelector {
diff --git a/e2e/common/traits/istio_test.go b/e2e/common/traits/istio_test.go
index 36e6cd1..092a051 100644
--- a/e2e/common/traits/istio_test.go
+++ b/e2e/common/traits/istio_test.go
@@ -24,32 +24,32 @@ package traits
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
-
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestIstioTrait(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("Run Java with Istio", func(t *testing.T) {
Expect(Kamel("run", "-n", ns, "../files/Java.java",
- "-t", "istio.enabled=true").Execute()).Should(BeNil())
+ "-t", "istio.enabled=true").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
pod := IntegrationPod(ns, "java")()
- Expect(pod.ObjectMeta.Annotations).ShouldNot(BeNil())
+ Expect(pod.ObjectMeta.Annotations).NotTo(BeNil())
annotations := pod.ObjectMeta.Annotations
- Expect(annotations["sidecar.istio.io/inject"]).Should(Equal("true"))
- Expect(annotations["traffic.sidecar.istio.io/includeOutboundIPRanges"]).Should(Equal("10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"))
+ Expect(annotations["sidecar.istio.io/inject"]).To(Equal("true"))
+ Expect(annotations["traffic.sidecar.istio.io/includeOutboundIPRanges"]).To(Equal("10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
diff --git a/e2e/common/traits/jolokia_test.go b/e2e/common/traits/jolokia_test.go
index 03ec7ee..689f706 100644
--- a/e2e/common/traits/jolokia_test.go
+++ b/e2e/common/traits/jolokia_test.go
@@ -25,23 +25,24 @@ import (
"fmt"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
- "github.com/stretchr/testify/assert"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestJolokiaTrait(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("Run Java with Jolokia", func(t *testing.T) {
Expect(Kamel("run", "-n", ns, "../files/Java.java",
"-t", "jolokia.enabled=true",
"-t", "jolokia.use-ssl-client-authentication=false",
"-t", "jolokia.protocol=http",
- "-t", "jolokia.extended-client-check=false").Execute()).Should(BeNil())
+ "-t", "jolokia.extended-client-check=false").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
@@ -49,12 +50,10 @@ func TestJolokiaTrait(t *testing.T) {
pod := IntegrationPod(ns, "java")
response, err := TestClient().CoreV1().RESTClient().Get().
AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/jolokia/", ns, pod().Name)).DoRaw(TestContext)
- if err != nil {
- assert.Fail(t, err.Error())
- }
- assert.Contains(t, string(response), `"status":200`)
+ Expect(err).To(BeNil())
+ Expect(response).To(ContainSubstring(`"status":200`))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}
diff --git a/e2e/common/traits/master_test.go b/e2e/common/traits/master_test.go
index 500c626..2d8cb8f 100644
--- a/e2e/common/traits/master_test.go
+++ b/e2e/common/traits/master_test.go
@@ -25,32 +25,31 @@ import (
"testing"
"time"
- . "github.com/apache/camel-k/e2e/support"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
)
func TestMasterTrait(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("master works", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "files/Master.java").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/Master.java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "master"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "master"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("only one integration with master runs", func(t *testing.T) {
- RegisterTestingT(t)
Expect(Kamel("run", "-n", ns, "files/Master.java",
"--name", "first",
"--label", "leader-group=same",
"-t", "master.label-key=leader-group",
"-t", "master.label-value=same",
- "-t", "owner.target-labels=leader-group").Execute()).Should(BeNil())
+ "-t", "owner.target-labels=leader-group").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "first"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "first"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
// Start a second integration with the same lock (it should not start the route)
@@ -60,12 +59,11 @@ func TestMasterTrait(t *testing.T) {
"-t", "master.label-key=leader-group",
"-t", "master.label-value=same",
"-t", "master.configmap=first-lock",
- "-t", "owner.target-labels=leader-group").Execute()).Should(BeNil())
+ "-t", "owner.target-labels=leader-group").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "second"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "second"), TestTimeoutShort).Should(ContainSubstring("started in"))
Eventually(IntegrationLogs(ns, "second"), 30*time.Second).ShouldNot(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
-
})
}
diff --git a/e2e/common/traits/pdb_test.go b/e2e/common/traits/pdb_test.go
index 8f888d9..c72e7b9 100644
--- a/e2e/common/traits/pdb_test.go
+++ b/e2e/common/traits/pdb_test.go
@@ -43,12 +43,12 @@ import (
func TestPodDisruptionBudget(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
name := "java"
- Expect(Kamel("install", "-n", ns).Execute()).To(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Expect(Kamel("run", "-n", ns, "../files/Java.java",
"--name", name,
"-t", "pdb.enabled=true",
"-t", "pdb.min-available=2",
- ).Execute()).To(BeNil())
+ ).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, name, camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
@@ -77,7 +77,7 @@ func TestPodDisruptionBudget(t *testing.T) {
Expect(UpdateIntegration(ns, name, func(it *camelv1.Integration) {
replicas := int32(2)
it.Spec.Replicas = &replicas
- })).To(BeNil())
+ })).To(Succeed())
Eventually(IntegrationPods(ns, name), TestTimeoutMedium).Should(HaveLen(2))
Eventually(IntegrationStatusReplicas(ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 2)))
@@ -130,7 +130,7 @@ func TestPodDisruptionBudget(t *testing.T) {
Expect(UpdateIntegration(ns, name, func(it *camelv1.Integration) {
replicas := int32(3)
it.Spec.Replicas = &replicas
- })).To(BeNil())
+ })).To(Succeed())
Eventually(IntegrationPods(ns, name), TestTimeoutMedium).Should(HaveLen(3))
Eventually(IntegrationStatusReplicas(ns, name), TestTimeoutShort).
Should(gstruct.PointTo(BeNumerically("==", 3)))
@@ -146,7 +146,7 @@ func TestPodDisruptionBudget(t *testing.T) {
Expect(err).To(Succeed())
// Clean up
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/prometheus_test.go b/e2e/common/traits/prometheus_test.go
index 9f3383e..e34d596 100644
--- a/e2e/common/traits/prometheus_test.go
+++ b/e2e/common/traits/prometheus_test.go
@@ -25,17 +25,19 @@ import (
"fmt"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
- "github.com/apache/camel-k/pkg/util/openshift"
-
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
- monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
v1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
+
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
+
+ monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+ "github.com/apache/camel-k/pkg/util/openshift"
)
func TestPrometheusTrait(t *testing.T) {
@@ -46,11 +48,11 @@ func TestPrometheusTrait(t *testing.T) {
// suppress Service Monitor for the time being as CI test runs on OCP 3.11
createServiceMonitor := false
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Expect(Kamel("run", "-n", ns, "../files/Java.java",
"-t", "prometheus.enabled=true",
- "-t", fmt.Sprintf("prometheus.service-monitor=%v", createServiceMonitor)).Execute()).Should(BeNil())
+ "-t", fmt.Sprintf("prometheus.service-monitor=%v", createServiceMonitor)).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
@@ -78,7 +80,7 @@ func TestPrometheusTrait(t *testing.T) {
})
}
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/common/traits/pull_secret_test.go b/e2e/common/traits/pull_secret_test.go
index 0854762..2317a39 100644
--- a/e2e/common/traits/pull_secret_test.go
+++ b/e2e/common/traits/pull_secret_test.go
@@ -24,39 +24,39 @@ package traits
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
- "github.com/apache/camel-k/pkg/util/openshift"
-
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+ "github.com/apache/camel-k/pkg/util/openshift"
)
func TestPullSecretTrait(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
ocp, err := openshift.IsOpenShift(TestClient())
- Expect(err).Should(BeNil())
+ Expect(err).To(BeNil())
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("Image pull secret is set on pod", func(t *testing.T) {
Expect(Kamel("run", "-n", ns, "../files/Java.java",
"-t", "pull-secret.enabled=true",
- "-t", "pull-secret.secret-name=dummy-secret").Execute()).Should(BeNil())
+ "-t", "pull-secret.secret-name=dummy-secret").Execute()).To(Succeed())
// pod may not run because the pull secret is dummy
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Or(Equal(v1.PodRunning), Equal(v1.PodPending)))
pod := IntegrationPod(ns, "java")()
- Expect(pod.Spec.ImagePullSecrets).ShouldNot(BeEmpty())
- Expect(pod.Spec.ImagePullSecrets[0].Name).Should(Equal("dummy-secret"))
+ Expect(pod.Spec.ImagePullSecrets).NotTo(BeEmpty())
+ Expect(pod.Spec.ImagePullSecrets[0].Name).To(Equal("dummy-secret"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("Explicity disable image pull secret", func(t *testing.T) {
Expect(Kamel("run", "-n", ns, "../files/Java.java",
- "-t", "pull-secret.enabled=false").Execute()).Should(BeNil())
+ "-t", "pull-secret.enabled=false").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
@@ -64,27 +64,27 @@ func TestPullSecretTrait(t *testing.T) {
pod := IntegrationPod(ns, "java")()
if ocp {
// OpenShift `default` service account has imagePullSecrets so it's always set
- Expect(pod.Spec.ImagePullSecrets).ShouldNot(BeEmpty())
+ Expect(pod.Spec.ImagePullSecrets).NotTo(BeEmpty())
} else {
- Expect(pod.Spec.ImagePullSecrets).Should(BeNil())
+ Expect(pod.Spec.ImagePullSecrets).To(BeNil())
}
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
if ocp {
// OpenShift always has an internal registry so image pull secret is set by default
t.Run("Image pull secret is automatically set by default", func(t *testing.T) {
- Expect(Kamel("run", "-n", ns, "../files/Java.java").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "../files/Java.java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
pod := IntegrationPod(ns, "java")()
- Expect(pod.Spec.ImagePullSecrets).ShouldNot(BeEmpty())
- Expect(pod.Spec.ImagePullSecrets[0].Name).Should(HavePrefix("default-dockercfg-"))
+ Expect(pod.Spec.ImagePullSecrets).NotTo(BeEmpty())
+ Expect(pod.Spec.ImagePullSecrets[0].Name).To(HavePrefix("default-dockercfg-"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
})
diff --git a/e2e/common/uninstall_test.go b/e2e/common/uninstall_test.go
index 00c229e..bbfb58d 100644
--- a/e2e/common/uninstall_test.go
+++ b/e2e/common/uninstall_test.go
@@ -24,18 +24,19 @@ package common
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
. "github.com/onsi/gomega"
+
+ . "github.com/apache/camel-k/e2e/support"
)
func TestBasicUninstall(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
// a successful new installation
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
// should be completely removed on uninstall
- Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles").Execute()).Should(BeNil())
+ Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles").Execute()).To(Succeed())
Eventually(Role(ns)).Should(BeNil())
Eventually(RoleBinding(ns)).Should(BeNil())
Eventually(Configmap(ns, "camel-k-maven-settings")).Should(BeNil())
@@ -47,10 +48,10 @@ func TestBasicUninstall(t *testing.T) {
func TestUninstallSkipOperator(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
// a successful new installation
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
// on uninstall it should remove everything except operator
- Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-operator").Execute()).Should(BeNil())
+ Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-operator").Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
})
}
@@ -58,10 +59,10 @@ func TestUninstallSkipOperator(t *testing.T) {
func TestUninstallSkipRole(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
// a successful new installation
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
// on uninstall it should remove everything except roles
- Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-roles").Execute()).Should(BeNil())
+ Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-roles").Execute()).To(Succeed())
Eventually(Role(ns)).ShouldNot(BeNil())
})
}
@@ -69,22 +70,21 @@ func TestUninstallSkipRole(t *testing.T) {
func TestUninstallSkipRoleBinding(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
// a successful new installation
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
// on uninstall it should remove everything except role-bindings
- Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-role-bindings").Execute()).Should(BeNil())
+ Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-role-bindings").Execute()).To(Succeed())
Eventually(RoleBinding(ns)).ShouldNot(BeNil())
})
}
func TestUninstallSkipServiceAccounts(t *testing.T) {
- //t.Skip("inconsistent test results ")
WithNewTestNamespace(t, func(ns string) {
// a successful new installation
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
// on uninstall it should remove everything except cluster-roles
- Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-service-accounts").Execute()).Should(BeNil())
+ Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-service-accounts").Execute()).To(Succeed())
Eventually(ServiceAccount(ns, "camel-k-operator")).ShouldNot(BeNil())
})
}
@@ -92,11 +92,11 @@ func TestUninstallSkipServiceAccounts(t *testing.T) {
func TestUninstallSkipIntegrationPlatform(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
// a successful new installation
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
// on uninstall it should remove everything except cluster-roles
// NOTE: skip CRDs is also required in addition to skip integration platform
- Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-integration-platform").Execute()).Should(BeNil())
+ Expect(Kamel("uninstall", "-n", ns, "--skip-crd", "--skip-cluster-roles", "--skip-integration-platform").Execute()).To(Succeed())
Eventually(Platform(ns)).ShouldNot(BeNil())
})
}
diff --git a/e2e/common/upgrade_test.go b/e2e/common/upgrade_test.go
index 00d1c22..9c493c7 100644
--- a/e2e/common/upgrade_test.go
+++ b/e2e/common/upgrade_test.go
@@ -25,15 +25,17 @@ import (
"testing"
"time"
- . "github.com/apache/camel-k/e2e/support"
- "github.com/apache/camel-k/pkg/util/defaults"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "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()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(OperatorPod(ns)).ShouldNot(BeNil())
Eventually(PlatformVersion(ns)).Should(Equal(defaults.Version))
@@ -42,7 +44,7 @@ func TestPlatformUpgrade(t *testing.T) {
Eventually(OperatorPod(ns)).Should(BeNil())
// Change the version to an older one
- Eventually(SetPlatformVersion(ns, "an.older.one")).Should(BeNil())
+ Eventually(SetPlatformVersion(ns, "an.older.one")).Should(Succeed())
Eventually(PlatformVersion(ns)).Should(Equal("an.older.one"))
// Scale the operator up
@@ -56,11 +58,11 @@ func TestPlatformUpgrade(t *testing.T) {
func TestIntegrationUpgrade(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(PlatformVersion(ns)).Should(Equal(defaults.Version))
// Run an integration
- Expect(Kamel("run", "-n", ns, "files/js.js").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/js.js").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "js"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
initialKit := IntegrationKit(ns, "js")()
@@ -69,8 +71,8 @@ func TestIntegrationUpgrade(t *testing.T) {
Eventually(OperatorPod(ns)).Should(BeNil())
// Change the version to an older one
- Expect(SetIntegrationVersion(ns, "js", "an.older.one")).Should(BeNil())
- Expect(SetAllKitsVersion(ns, "an.older.one")).Should(BeNil())
+ Expect(SetIntegrationVersion(ns, "js", "an.older.one")).To(Succeed())
+ Expect(SetAllKitsVersion(ns, "an.older.one")).To(Succeed())
Eventually(IntegrationVersion(ns, "js")).Should(Equal("an.older.one"))
Eventually(KitsWithVersion(ns, "an.older.one")).Should(Equal(1))
Eventually(KitsWithVersion(ns, defaults.Version)).Should(Equal(0))
@@ -84,7 +86,7 @@ func TestIntegrationUpgrade(t *testing.T) {
Consistently(IntegrationVersion(ns, "js"), 3*time.Second).Should(Equal("an.older.one"))
// Clear the integration status
- Expect(Kamel("rebuild", "js", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("rebuild", "js", "-n", ns).Execute()).To(Succeed())
// Check the integration version change
Eventually(IntegrationVersion(ns, "js")).Should(Equal(defaults.Version))
diff --git a/e2e/knative/kamelet_test.go b/e2e/knative/kamelet_test.go
index cfc90f3..7e705d4 100644
--- a/e2e/knative/kamelet_test.go
+++ b/e2e/knative/kamelet_test.go
@@ -24,37 +24,36 @@ package knative
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
messaging "knative.dev/eventing/pkg/apis/messaging/v1beta1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
// Test that kamelet binding can be changed and changes propagated to integrations
func TestKameletChange(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- RegisterTestingT(t)
-
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
- Expect(CreateTimerKamelet(ns, "timer-source")()).Should(BeNil())
- Expect(CreateKnativeChannelv1Beta1(ns, "messages")()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/display.groovy", "-w").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
+ Expect(CreateTimerKamelet(ns, "timer-source")()).To(Succeed())
+ Expect(CreateKnativeChannelv1Beta1(ns, "messages")()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/display.groovy", "-w").Execute()).To(Succeed())
ref := v1.ObjectReference{
Kind: "InMemoryChannel",
Name: "messages",
APIVersion: messaging.SchemeGroupVersion.String(),
}
- Expect(BindKameletTo(ns, "timer-binding", "timer-source", ref, map[string]string{"message": "message is Hello"})()).Should(BeNil())
+ Expect(BindKameletTo(ns, "timer-binding", "timer-source", ref, map[string]string{"message": "message is Hello"})()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "timer-binding"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "timer-binding", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "display"), TestTimeoutShort).Should(ContainSubstring("message is Hello"))
- Expect(BindKameletTo(ns, "timer-binding", "timer-source", ref, map[string]string{"message": "message is Hi"})()).Should(BeNil())
+ Expect(BindKameletTo(ns, "timer-binding", "timer-source", ref, map[string]string{"message": "message is Hi"})()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "timer-binding"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "timer-binding", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "display"), TestTimeoutShort).Should(ContainSubstring("message is Hi"))
})
-
}
diff --git a/e2e/knative/knative_platform_test.go b/e2e/knative/knative_platform_test.go
index 70c20f6..4bb5952 100644
--- a/e2e/knative/knative_platform_test.go
+++ b/e2e/knative/knative_platform_test.go
@@ -37,21 +37,20 @@ import (
"github.com/apache/camel-k/pkg/util/knative"
)
-func TestKnativePlatformTest(t *testing.T) {
+func TestKnativePlatform(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
if !knative.IsEnabledInNamespace(TestContext, TestClient(), ns) {
t.Error("Knative not installed in the cluster")
t.FailNow()
}
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
Eventually(PlatformProfile(ns), TestTimeoutShort).Should(Equal(v1.TraitProfile("")))
cluster := Platform(ns)().Status.Cluster
t.Run("run yaml on cluster profile", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "files/yaml.yaml", "--profile", string(cluster)).Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/yaml.yaml", "--profile", string(cluster)).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationLogs(ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
Eventually(IntegrationProfile(ns, "yaml"), TestTimeoutShort).Should(Equal(v1.TraitProfile(string(cluster))))
@@ -64,7 +63,7 @@ func TestKnativePlatformTest(t *testing.T) {
newFlows, err := flow.FromYamlDSLString(newData)
assert.NoError(t, err)
it.Spec.Flows = newFlows
- })).To(BeNil())
+ })).To(Succeed())
// Spec profile should be reset by "kamel run"
Eventually(IntegrationSpecProfile(ns, "yaml")).Should(Equal(v1.TraitProfile("")))
// When integration is running again ...
@@ -73,16 +72,14 @@ func TestKnativePlatformTest(t *testing.T) {
// It should keep the old profile saved in status
Eventually(IntegrationProfile(ns, "yaml"), TestTimeoutMedium).Should(Equal(v1.TraitProfile(string(cluster))))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run yaml on automatic profile", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationProfile(ns, "yaml"), TestTimeoutShort).Should(Equal(v1.TraitProfileKnative))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
-
})
}
diff --git a/e2e/knative/knative_test.go b/e2e/knative/knative_test.go
index 28e06e0..33e11c3 100644
--- a/e2e/knative/knative_test.go
+++ b/e2e/knative/knative_test.go
@@ -25,23 +25,24 @@ import (
"testing"
"time"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunServiceCombo(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
-
- Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knative2.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knative2.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "knative2"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "knative2", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
- Expect(Kamel("run", "-n", ns, "files/knative3.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/knative3.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "knative3"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "knative3", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
- Expect(Kamel("run", "-n", ns, "files/knative1.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "files/knative1.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "knative1"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "knative1", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
// Correct logs
@@ -50,50 +51,47 @@ func TestRunServiceCombo(t *testing.T) {
// Incorrect logs
Consistently(IntegrationLogs(ns, "knative1"), 10*time.Second).ShouldNot(ContainSubstring("Received from 2: Hello from knative3"))
Consistently(IntegrationLogs(ns, "knative1"), 10*time.Second).ShouldNot(ContainSubstring("Received from 3: Hello from knative2"))
- // Cleanup
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ // Clean up
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRunChannelComboV1Alpha1(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
-
- Expect(CreateKnativeChannelv1Alpha1(ns, "messages")()).Should(BeNil())
- Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knativech2.groovy").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knativech1.groovy").Execute()).Should(BeNil())
+ Expect(CreateKnativeChannelv1Alpha1(ns, "messages")()).To(Succeed())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knativech2.groovy").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knativech1.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "knativech2"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationPodPhase(ns, "knativech1"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "knativech2"), TestTimeoutMedium).Should(ContainSubstring("Received: Hello from knativech1"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRunChannelComboV1Beta1(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
-
- Expect(CreateKnativeChannelv1Beta1(ns, "messages")()).Should(BeNil())
- Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knativech2.groovy").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knativech1.groovy").Execute()).Should(BeNil())
+ Expect(CreateKnativeChannelv1Beta1(ns, "messages")()).To(Succeed())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knativech2.groovy").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knativech1.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "knativech2"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationPodPhase(ns, "knativech1"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "knativech2"), TestTimeoutMedium).Should(ContainSubstring("Received: Hello from knativech1"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRunChannelComboGetToPost(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
-
- Expect(CreateKnativeChannelv1Beta1(ns, "messages")()).Should(BeNil())
- Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knativegetpost2.groovy").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knativegetpost1.groovy").Execute()).Should(BeNil())
+ Expect(CreateKnativeChannelv1Beta1(ns, "messages")()).To(Succeed())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knativegetpost2.groovy").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knativegetpost1.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "knativegetpost2"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationPodPhase(ns, "knativegetpost1"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "knativegetpost2"), TestTimeoutMedium).Should(ContainSubstring(`Received ""`))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
@@ -101,12 +99,12 @@ func TestRunChannelComboGetToPost(t *testing.T) {
// FIXME: uncomment when https://github.com/apache/camel-k-runtime/issues/69 is resolved
func TestRunMultiChannelChain(t *testing.T) {
withNewTestNamespace(t, func(ns string) {
- Expect(createKnativeChannel(ns, "messages")()).Should(BeNil())
- Expect(createKnativeChannel(ns, "words")()).Should(BeNil())
- Expect(kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).Should(BeNil())
- Expect(kamel("run", "-n", ns, "files/knativemultihop3.groovy").Execute()).Should(BeNil())
- Expect(kamel("run", "-n", ns, "files/knativemultihop2.groovy").Execute()).Should(BeNil())
- Expect(kamel("run", "-n", ns, "files/knativemultihop1.groovy").Execute()).Should(BeNil())
+ Expect(createKnativeChannel(ns, "messages")()).To(Succeed())
+ Expect(createKnativeChannel(ns, "words")()).To(Succeed())
+ Expect(kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).To(Succeed())
+ Expect(kamel("run", "-n", ns, "files/knativemultihop3.groovy").Execute()).To(Succeed())
+ Expect(kamel("run", "-n", ns, "files/knativemultihop2.groovy").Execute()).To(Succeed())
+ Expect(kamel("run", "-n", ns, "files/knativemultihop1.groovy").Execute()).To(Succeed())
Eventually(integrationPodPhase(ns, "knativemultihop3"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(integrationPodPhase(ns, "knativemultihop2"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(integrationPodPhase(ns, "knativemultihop1"), TestTimeoutLong).Should(Equal(v1.PodRunning))
@@ -116,31 +114,31 @@ func TestRunMultiChannelChain(t *testing.T) {
Eventually(integrationLogs(ns, "knativemultihop3"), 10*time.Second).ShouldNot(ContainSubstring(`From messages: word`))
Eventually(integrationLogs(ns, "knativemultihop3"), 10*time.Second).ShouldNot(ContainSubstring(`From words: message`))
Eventually(integrationLogs(ns, "knativemultihop3"), 10*time.Second).ShouldNot(ContainSubstring(`From messages: transformed message`))
- Expect(kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
*/
func TestRunBroker(t *testing.T) {
WithNewTestNamespaceWithKnativeBroker(t, func(ns string) {
- Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knativeevt1.groovy").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/knativeevt2.groovy").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knativeevt1.groovy").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/knativeevt2.groovy").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "knativeevt1"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationPodPhase(ns, "knativeevt2"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationLogs(ns, "knativeevt2"), TestTimeoutMedium).Should(ContainSubstring("Received 1: Hello 1"))
Eventually(IntegrationLogs(ns, "knativeevt2"), TestTimeoutMedium).Should(ContainSubstring("Received 2: Hello 2"))
Eventually(IntegrationLogs(ns, "knativeevt2")).ShouldNot(ContainSubstring("Received 1: Hello 2"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestRunFlow(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).Should(BeNil())
- Expect(Kamel("run", "-n", ns, "files/flow.yaml").Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", "knative").Execute()).To(Succeed())
+ Expect(Kamel("run", "-n", ns, "files/flow.yaml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "flow"), TestTimeoutLong).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "flow", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/knative/openapi_test.go b/e2e/knative/openapi_test.go
index c9a3044..97068bd 100644
--- a/e2e/knative/openapi_test.go
+++ b/e2e/knative/openapi_test.go
@@ -24,22 +24,24 @@ package knative
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
corev1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestOpenAPIService(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns, "--trait-profile", string(v1.TraitProfileKnative)).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", string(v1.TraitProfileKnative)).Execute()).To(Succeed())
Expect(Kamel(
"run",
"-n", ns,
"--name", "petstore",
"--open-api", "files/petstore-api.yaml",
"files/petstore.groovy",
- ).Execute()).Should(BeNil())
+ ).Execute()).To(Succeed())
Eventually(KnativeService(ns, "petstore"), TestTimeoutLong).
Should(Not(BeNil()))
@@ -51,20 +53,20 @@ func TestOpenAPIService(t *testing.T) {
Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
Should(ContainSubstring("Route: showPetById started and consuming from: platform-http:///v1/pets"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
func TestOpenAPIDeployment(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns, "--trait-profile", string(v1.TraitProfileKubernetes)).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns, "--trait-profile", string(v1.TraitProfileKubernetes)).Execute()).To(Succeed())
Expect(Kamel(
"run",
"-n", ns,
"--name", "petstore",
"--open-api", "files/petstore-api.yaml",
"files/petstore.groovy",
- ).Execute()).Should(BeNil())
+ ).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "petstore"), TestTimeoutLong).
Should(Equal(corev1.PodRunning))
@@ -78,6 +80,6 @@ func TestOpenAPIDeployment(t *testing.T) {
Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
Should(ContainSubstring("Route: showPetById started and consuming from: platform-http:///v1/pets"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
}
diff --git a/e2e/local/local_run_test.go b/e2e/local/local_run_test.go
index 2e97df4..8d12752 100644
--- a/e2e/local/local_run_test.go
+++ b/e2e/local/local_run_test.go
@@ -24,10 +24,11 @@ import (
"io"
"testing"
- . "github.com/apache/camel-k/e2e/support"
- "github.com/apache/camel-k/e2e/support/util"
"github.com/golangplus/testing/assert"
. "github.com/onsi/gomega"
+
+ . "github.com/apache/camel-k/e2e/support"
+ "github.com/apache/camel-k/e2e/support/util"
)
func TestLocalRun(t *testing.T) {
diff --git a/e2e/resources/resources_test.go b/e2e/resources/resources_test.go
index 7625e8e..c7b08ba 100644
--- a/e2e/resources/resources_test.go
+++ b/e2e/resources/resources_test.go
@@ -24,34 +24,33 @@ package resources
import (
"testing"
- . "github.com/apache/camel-k/e2e/support"
- camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
. "github.com/onsi/gomega"
+
v1 "k8s.io/api/core/v1"
+
+ . "github.com/apache/camel-k/e2e/support"
+ camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
func TestRunResourceExamples(t *testing.T) {
-
WithNewTestNamespace(t, func(ns string) {
- Expect(Kamel("install", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
t.Run("run java", func(t *testing.T) {
- RegisterTestingT(t)
- Expect(Kamel("run", "-n", ns, "./files/ResourcesText.java", "--resource", "./files/resources-data.txt").Execute()).Should(BeNil())
+ Expect(Kamel("run", "-n", ns, "./files/ResourcesText.java", "--resource", "./files/resources-data.txt").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "resources-text"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "resources-text", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "resources-text"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
t.Run("run java", func(t *testing.T) {
- RegisterTestingT(t)
Expect(Kamel("run", "-n", ns, "./files/ResourcesBinary.java",
- "--resource", "./files/resources-data.zip", "-d", "camel-zipfile").Execute()).Should(BeNil())
+ "--resource", "./files/resources-data.zip", "-d", "camel-zipfile").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "resources-binary"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(IntegrationCondition(ns, "resources-binary", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
Eventually(IntegrationLogs(ns, "resources-binary"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
})
}