You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/03/09 15:37:44 UTC
[camel-k] 04/06: fix(test): code refactoring
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch release-1.10.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit a0d6e27895ba5d4d043f95bdfdaab2407242724b
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Mon Mar 6 14:48:27 2023 +0100
fix(test): code refactoring
Ref #4086
---
e2e/namespace/install/cli/delete_test.go | 8 --------
e2e/namespace/install/cli/run_test.go | 20 +++++++++++---------
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/e2e/namespace/install/cli/delete_test.go b/e2e/namespace/install/cli/delete_test.go
index e453a304b..a1523df68 100644
--- a/e2e/namespace/install/cli/delete_test.go
+++ b/e2e/namespace/install/cli/delete_test.go
@@ -52,14 +52,6 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPod(ns, "yaml"), TestTimeoutMedium).Should(BeNil())
})
- t.Run("delete integration from csv", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "github:apache/camel-k/e2e/namespace/install/cli/files/yaml.yaml").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed())
- Eventually(Integration(ns, "yaml")).Should(BeNil())
- Eventually(IntegrationPod(ns, "yaml"), TestTimeoutMedium).Should(BeNil())
- })
-
t.Run("delete several integrations", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns, "../files/yaml.yaml").Execute()).To(Succeed())
Expect(KamelRunWithID(operatorID, ns, "../files/Java.java").Execute()).To(Succeed())
diff --git a/e2e/namespace/install/cli/run_test.go b/e2e/namespace/install/cli/run_test.go
index 4bca39e8a..e367f6356 100644
--- a/e2e/namespace/install/cli/run_test.go
+++ b/e2e/namespace/install/cli/run_test.go
@@ -36,6 +36,8 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
+var sampleJar = "https://raw.githubusercontent.com/apache/camel-k/main/e2e/common/traits/files/jvm/sample-1.0.jar"
+
func TestKamelCLIRun(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
operatorID := fmt.Sprintf("camel-k-%s", ns)
@@ -44,33 +46,33 @@ func TestKamelCLIRun(t *testing.T) {
t.Run("Examples from GitHub", func(t *testing.T) {
t.Run("Java", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns,
- "github:apache/camel-k/e2e/namespace/install/files/Java.java").Execute()).To(Succeed())
+ "github:apache/camel-k-examples/generic-examples/languages/Sample.java", "--name", "java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
+ Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Java (RAW)", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns,
- "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/files/Java.java").Execute()).
+ "https://raw.githubusercontent.com/apache/camel-k-examples/main/generic-examples/languages/Sample.java", "--name", "java").Execute()).
To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
+ Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Java (branch)", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns,
- "github:apache/camel-k/e2e/namespace/install/files/Java.java?branch=main").Execute()).To(Succeed())
+ "github:apache/camel-k-examples/generic-examples/languages/Sample.java?branch=main", "--name", "java").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
+ Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Hello Camel K!"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
})
t.Run("Gist (ID)", func(t *testing.T) {