You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/10/12 03:42:20 UTC
[camel-k] branch main updated: Due to slower performance revert tests to sub-tests from separate functions
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new b17c5dfbb Due to slower performance revert tests to sub-tests from separate functions
b17c5dfbb is described below
commit b17c5dfbbd58f308512c2a0284f7319274fe1598
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Mon Oct 10 12:40:32 2022 +0100
Due to slower performance revert tests to sub-tests from separate functions
* Separating a test into functions make the test considerably slower.
Therefore, splitting the test should only be a last resort course of
action
* test_support.go
* Improves the delete integrations function to wait for the deletion to
complete before moving on
---
e2e/global/common/config/config_test.go | 741 ++++++++++++++------------------
e2e/namespace/install/cli/run_test.go | 284 ++++++------
e2e/support/test_support.go | 33 ++
3 files changed, 490 insertions(+), 568 deletions(-)
diff --git a/e2e/global/common/config/config_test.go b/e2e/global/common/config/config_test.go
index e518f8a1e..df6601940 100644
--- a/e2e/global/common/config/config_test.go
+++ b/e2e/global/common/config/config_test.go
@@ -24,438 +24,349 @@ package resources
import (
"fmt"
- "io/ioutil"
"testing"
- "github.com/stretchr/testify/assert"
-
. "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"
- "github.com/apache/camel-k/pkg/util/gzip"
)
-func operatorID(ns string) string {
- return fmt.Sprintf("camel-k-%s", ns)
-}
-
-func installWithID(ns string) {
- Expect(KamelInstallWithID(operatorID(ns), ns).Execute()).To(Succeed())
-}
-
-func TestRunConfigExampleSimpleProperty(t *testing.T) {
+func TestRunConfigExamples(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
+ operatorID := fmt.Sprintf("camel-k-%s", ns)
+ Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())
// Properties
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "my.message=test-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("test-property"))
- })
-}
-
-func TestRunConfigExamplePropertyFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-file-route.groovy", "--property", "file:./files/my.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
- })
-}
-
-func TestRunConfigExamplePropertyPrecedence(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-file-route.groovy", "-p", "my.key.2=universe", "-p", "file:./files/my.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello universe"))
- })
-}
-
-func TestRunConfigExamplePropertyConfigMap(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- var cmData = make(map[string]string)
- cmData["my.message"] = "my-configmap-property-value"
- CreatePlainTextConfigmap(ns, "my-cm-test-property", cmData)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-value"))
- })
-}
-
-func TestRunConfigExampleConfigMapPropertyFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
+ // t.Run("Simple property", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "my.message=test-property").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("test-property"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Property file", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/property-file-route.groovy", "--property", "file:./files/my.properties").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Property precedence", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/property-file-route.groovy", "-p", "my.key.2=universe", "-p", "file:./files/my.properties").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "property-file-route"), TestTimeoutShort).Should(ContainSubstring("hello universe"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Property from ConfigMap", func(t *testing.T) {
+ // var cmData = make(map[string]string)
+ // cmData["my.message"] = "my-configmap-property-value"
+ // CreatePlainTextConfigmap(ns, "my-cm-test-property", cmData)
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-property").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-value"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Property from ConfigMap as property file", func(t *testing.T) {
+ // var cmData = make(map[string]string)
+ // cmData["my.properties"] = "my.message=my-configmap-property-entry"
+ // CreatePlainTextConfigmap(ns, "my-cm-test-properties", cmData)
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-properties").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-entry"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Property from Secret", func(t *testing.T) {
+ // var secData = make(map[string]string)
+ // secData["my.message"] = "my-secret-property-value"
+ // CreatePlainTextSecret(ns, "my-sec-test-property", secData)
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-property").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-value"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Property from Secret as property file", func(t *testing.T) {
+ // var secData = make(map[string]string)
+ // secData["my.properties"] = "my.message=my-secret-property-entry"
+ // CreatePlainTextSecret(ns, "my-sec-test-properties", secData)
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-properties").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-entry"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // // Configmap
+
+ // Store a configmap on the cluster
var cmData = make(map[string]string)
- cmData["my.properties"] = "my.message=my-configmap-property-entry"
- CreatePlainTextConfigmap(ns, "my-cm-test-properties", cmData)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "configmap:my-cm-test-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-configmap-property-entry"))
- })
-}
-
-func TestRunConfigExamplePropertySecret(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- var secData = make(map[string]string)
- secData["my.message"] = "my-secret-property-value"
- CreatePlainTextSecret(ns, "my-sec-test-property", secData)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-value"))
- })
-}
-
-func TestRunConfigExampleSecretPropertyFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- var secData = make(map[string]string)
- secData["my.properties"] = "my.message=my-secret-property-entry"
- CreatePlainTextSecret(ns, "my-sec-test-properties", secData)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/property-route.groovy", "-p", "secret:my-sec-test-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "property-route"), TestTimeoutShort).Should(ContainSubstring("my-secret-property-entry"))
- })
-}
-
-// Store a configmap on the cluster
-func createConfigMap(ns string) map[string]string {
- var cmData = make(map[string]string)
- cmData["my-configmap-key"] = "my-configmap-content"
- CreatePlainTextConfigmap(ns, "my-cm", cmData)
- return cmData
-}
-
-// Store a configmap with multiple values
-func createMultiConfigMap(ns string) map[string]string {
- var cmDataMulti = make(map[string]string)
- cmDataMulti["my-configmap-key"] = "should-not-see-it"
- cmDataMulti["my-configmap-key-2"] = "my-configmap-content-2"
- CreatePlainTextConfigmap(ns, "my-cm-multi", cmDataMulti)
- return cmDataMulti
-}
-
-func TestRunConfigPropertyConfigMap(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
- cmData := createConfigMap(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-configmap-route.groovy", "--config", "configmap:my-cm").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
- })
-}
-
-func TestRunConfigResourceConfigMap(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
- cmData := createConfigMap(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-configmap-route.groovy", "--resource", "configmap:my-cm").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
- })
-}
-
-func TestRunConfigDestinationConfigMap(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
- cmData := createConfigMap(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-configmap-location-route.groovy", "--resource", "configmap:my-cm@/tmp/app").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-configmap-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-configmap-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-configmap-location-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
- })
-}
-
-func TestRunConfigFilteredConfigMap(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
- cmDataMulti := createMultiConfigMap(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-configmap-key-location-route.groovy", "--resource", "configmap:my-cm-multi/my-configmap-key-2@/tmp/app/test.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-configmap-key-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-configmap-key-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).ShouldNot(ContainSubstring(cmDataMulti["my-configmap-key"]))
- Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).Should(ContainSubstring(cmDataMulti["my-configmap-key-2"]))
- })
-}
-
-func TestRunConfigPropertyConfigMapFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- // Store a configmap as property file
- var cmDataProps = make(map[string]string)
- cmDataProps["my.properties"] = "my.key.1=hello\nmy.key.2=world"
- CreatePlainTextConfigmap(ns, "my-cm-properties", cmDataProps)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-configmap-properties-route.groovy", "--config", "configmap:my-cm-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-configmap-properties-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-configmap-properties-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-configmap-properties-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
- })
-}
-
-func createSecret(ns string) map[string]string {
- // Store a secret on the cluster
- var secData = make(map[string]string)
- secData["my-secret-key"] = "very top secret"
- CreatePlainTextSecret(ns, "my-sec", secData)
- return secData
-}
-
-func createMultiSecret(ns string) map[string]string {
- // Store a secret with multi values
- var secDataMulti = make(map[string]string)
- secDataMulti["my-secret-key"] = "very top secret"
- secDataMulti["my-secret-key-2"] = "even more secret"
- CreatePlainTextSecret(ns, "my-sec-multi", secDataMulti)
- return secDataMulti
-}
-
-func TestRunConfigPropertyConfigSecret(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
- secData := createSecret(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-secret-route.groovy", "--config", "secret:my-sec").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
- })
-}
-
-func TestRunConfigPropertyResourceSecret(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
- secData := createSecret(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-secret-route.groovy", "--resource", "secret:my-sec").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
- })
-}
-
-func TestRunConfigSecretFilteredKey(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
- secDataMulti := createMultiSecret(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-secret-key-route.groovy", "--config", "secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-secret-key-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-secret-key-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-secret-key-route"), TestTimeoutShort).ShouldNot(ContainSubstring(secDataMulti["my-secret-key"]))
- Eventually(IntegrationLogs(ns, "config-secret-key-route"), TestTimeoutShort).Should(ContainSubstring(secDataMulti["my-secret-key-2"]))
- })
-}
-
-// Config File
-func TestRunConfigPlainTextFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/config-file-route.groovy", "--config", "file:./files/resources-data.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- })
-}
-
-// Resource File
-func TestRunConfigResourceFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- })
-}
-
-func TestRunConfigDestinationPlainTextFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-location-route.groovy", "--resource", "file:./files/resources-data.txt@/tmp/file.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-location-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- })
-}
-
-func TestRunConfigZipFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-binary-route.groovy", "--resource", "file:./files/resources-data.zip", "-d", "camel:zipfile").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-binary-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-binary-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-binary-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- })
-}
-
-func TestRunConfigBase64File(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- // We calculate the expected content
- source, err := ioutil.ReadFile("./files/resources-data.txt")
- assert.Nil(t, err)
- expectedBytes, err := gzip.CompressBase64([]byte(source))
- assert.Nil(t, err)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-base64-encoded-route.groovy", "--resource", "file:./files/resources-data.txt", "--compression=true").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-base64-encoded-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-base64-encoded-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-base64-encoded-route"), TestTimeoutShort).Should(ContainSubstring(string(expectedBytes)))
- })
-}
-
-func TestRunConfigPlainTextFileSameContent(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt",
- "--resource", "file:./files/resources-data-same.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- })
-}
-
-func TestRunConfigBuildProperty(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- // Build-Properties
- t.Run("Build time property", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-route.groovy", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
- // Don't delete - we need it for next test execution
+ cmData["my-configmap-key"] = "my-configmap-content"
+ CreatePlainTextConfigmap(ns, "my-cm", cmData)
+
+ // // Store a configmap with multiple values
+ // var cmDataMulti = make(map[string]string)
+ // cmDataMulti["my-configmap-key"] = "should-not-see-it"
+ // cmDataMulti["my-configmap-key-2"] = "my-configmap-content-2"
+ // CreatePlainTextConfigmap(ns, "my-cm-multi", cmDataMulti)
+ //
+ // t.Run("Config configmap", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/config-configmap-route.groovy", "--config", "configmap:my-cm").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "config-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "config-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "config-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Resource configmap", func(t *testing.T) {
+ // // We can reuse the configmap created previously
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-configmap-route.groovy", "--resource", "configmap:my-cm").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-configmap-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-configmap-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-configmap-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Resource configmap with destination", func(t *testing.T) {
+ // // We can reuse the configmap created previously
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-configmap-location-route.groovy", "--resource", "configmap:my-cm@/tmp/app").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-configmap-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-configmap-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-configmap-location-route"), TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Resource configmap with filtered key and destination", func(t *testing.T) {
+ // // We'll use the configmap contaning 2 values filtering only 1 key
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-configmap-key-location-route.groovy", "--resource", "configmap:my-cm-multi/my-configmap-key-2@/tmp/app/test.txt").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-configmap-key-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-configmap-key-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).ShouldNot(ContainSubstring(cmDataMulti["my-configmap-key"]))
+ // Eventually(IntegrationLogs(ns, "resource-configmap-key-location-route"), TestTimeoutShort).Should(ContainSubstring(cmDataMulti["my-configmap-key-2"]))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // // Store a configmap as property file
+ // var cmDataProps = make(map[string]string)
+ // cmDataProps["my.properties"] = "my.key.1=hello\nmy.key.2=world"
+ // CreatePlainTextConfigmap(ns, "my-cm-properties", cmDataProps)
+ //
+ // t.Run("Config configmap as property file", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/config-configmap-properties-route.groovy", "--config", "configmap:my-cm-properties").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "config-configmap-properties-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "config-configmap-properties-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "config-configmap-properties-route"), TestTimeoutShort).Should(ContainSubstring("hello world"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // // Secret
+ //
+ // // Store a secret on the cluster
+ // var secData = make(map[string]string)
+ // secData["my-secret-key"] = "very top secret"
+ // CreatePlainTextSecret(ns, "my-sec", secData)
+ //
+ // // Store a secret with multi values
+ // var secDataMulti = make(map[string]string)
+ // secDataMulti["my-secret-key"] = "very top secret"
+ // secDataMulti["my-secret-key-2"] = "even more secret"
+ // CreatePlainTextSecret(ns, "my-sec-multi", secDataMulti)
+ //
+ // t.Run("Config secret", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/config-secret-route.groovy", "--config", "secret:my-sec").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "config-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "config-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "config-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Resource secret", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-secret-route.groovy", "--resource", "secret:my-sec").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-secret-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-secret-route"), TestTimeoutShort).Should(ContainSubstring(secData["my-secret-key"]))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // // Config File
+ //
+ // t.Run("Plain text configuration file", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/config-file-route.groovy", "--config", "file:./files/resources-data.txt").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "config-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "config-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "config-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
+ // })
+ //
+ // t.Run("Secret with filtered key", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/config-secret-key-route.groovy", "--config", "secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "config-secret-key-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "config-secret-key-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "config-secret-key-route"), TestTimeoutShort).ShouldNot(ContainSubstring(secDataMulti["my-secret-key"]))
+ // Eventually(IntegrationLogs(ns, "config-secret-key-route"), TestTimeoutShort).Should(ContainSubstring(secDataMulti["my-secret-key-2"]))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // // Resource File
+ //
+ // t.Run("Plain text resource file", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
+ // })
+ //
+ // t.Run("Plain text resource file with destination path", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-location-route.groovy", "--resource", "file:./files/resources-data.txt@/tmp/file.txt").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-file-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-file-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-file-location-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
+ // })
+ //
+ // t.Run("Binary (zip) resource file", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-binary-route.groovy", "--resource", "file:./files/resources-data.zip", "-d", "camel:zipfile").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-file-binary-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-file-binary-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-file-binary-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
+ // })
+ //
+ // t.Run("Base64 compressed binary resource file", func(t *testing.T) {
+ // // We calculate the expected content
+ // source, err := ioutil.ReadFile("./files/resources-data.txt")
+ // assert.Nil(t, err)
+ // expectedBytes, err := gzip.CompressBase64([]byte(source))
+ // assert.Nil(t, err)
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-base64-encoded-route.groovy", "--resource", "file:./files/resources-data.txt", "--compression=true").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-file-base64-encoded-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-file-base64-encoded-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-file-base64-encoded-route"), TestTimeoutShort).Should(ContainSubstring(string(expectedBytes)))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
+ // })
+ //
+ // t.Run("Plain text resource file with same content", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt",
+ // "--resource", "file:./files/resources-data-same.txt").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
+ // })
+ //
+ // // Build-Properties
+ // t.Run("Build time property", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/build-property-route.groovy", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "build-property-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "build-property-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "build-property-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
+ // // Don't delete - we need it for next test execution
+ // })
+ //
+ // // We need to check also that the property (which is available in the IntegrationKit) is correctly replaced and we don't reuse the same kit
+ // t.Run("Build time property updated", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/build-property-route.groovy", "--name", "build-property-route-updated",
+ // "--build-property", "quarkus.application.name=my-super-application-updated").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "build-property-route-updated"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "build-property-route-updated", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "build-property-route-updated"), TestTimeoutShort).Should(ContainSubstring("my-super-application-updated"))
+ // // Verify the integration kits are different
+ // Expect(IntegrationKit(ns, "build-property-route")).ShouldNot(Equal(IntegrationKit(ns, "build-property-route-updated")))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // // Build-Properties file
+ // t.Run("Build time property file", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Build time property file with precedence", func(t *testing.T) {
+ // Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutMedium).Should(ContainSubstring("my-overridden-application"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+
+ t.Run("Build time property from ConfigMap", func(t *testing.T) {
+ var cmData = make(map[string]string)
+ cmData["quarkus.application.name"] = "my-cool-application"
+ CreatePlainTextConfigmap(ns, "my-cm-test-build-property", cmData)
+ Eventually(Configmap(ns, "my-cm-test-build-property"), TestTimeoutShort).ShouldNot(BeNil())
+
+ Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutLong).Should(ContainSubstring("my-cool-application"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
})
- // We need to check also that the property (which is available in the IntegrationKit) is correctly replaced and we don't reuse the same kit
- t.Run("Build time property updated", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-route.groovy", "--name", "build-property-route-updated",
- "--build-property", "quarkus.application.name=my-super-application-updated").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-route-updated"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-route-updated", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-route-updated"), TestTimeoutShort).Should(ContainSubstring("my-super-application-updated"))
- // Verify the integration kits are different
- Expect(IntegrationKit(ns, "build-property-route")).ShouldNot(Equal(IntegrationKit(ns, "build-property-route-updated")))
+ t.Run("Build time property from ConfigMap as property file", func(t *testing.T) {
+ var cmData = make(map[string]string)
+ cmData["my.properties"] = "quarkus.application.name=my-super-cool-application"
+ CreatePlainTextConfigmap(ns, "my-cm-test-build-properties", cmData)
+ Eventually(Configmap(ns, "my-cm-test-build-properties"), TestTimeoutShort).ShouldNot(BeNil())
+
+ Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-cool-application"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
})
- })
-}
-
-func TestRunConfigBuildPropertyFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- // Build-Properties file
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-application"))
- })
-}
-
-func TestRunConfigBuildPropertytFilePrecedence(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutMedium).Should(ContainSubstring("my-overridden-application"))
- })
-}
-
-func TestRunConfigBuildPropertyConfigMap(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- var cmData = make(map[string]string)
- cmData["quarkus.application.name"] = "my-cool-application"
- CreatePlainTextConfigmap(ns, "my-cm-test-build-property", cmData)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutLong).Should(ContainSubstring("my-cool-application"))
- })
-}
-
-func TestRunConfigBuildPropertyConfigMapFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- var cmData = make(map[string]string)
- cmData["my.properties"] = "quarkus.application.name=my-super-cool-application"
- CreatePlainTextConfigmap(ns, "my-cm-test-build-properties", cmData)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "configmap:my-cm-test-build-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-super-cool-application"))
- })
-}
-
-func TestRunConfigBuildPropertySecret(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- var secData = make(map[string]string)
- secData["quarkus.application.name"] = "my-great-application"
- CreatePlainTextSecret(ns, "my-sec-test-build-property", secData)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-property").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-great-application"))
- })
-}
-
-func TestRunConfigBuildPropertySecretFile(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- var secData = make(map[string]string)
- secData["my.properties"] = "quarkus.application.name=my-awsome-application"
- CreatePlainTextSecret(ns, "my-sec-test-build-properties", secData)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-awsome-application"))
+ //
+ // t.Run("Build time property from Secret", func(t *testing.T) {
+ // var secData = make(map[string]string)
+ // secData["quarkus.application.name"] = "my-great-application"
+ // CreatePlainTextSecret(ns, "my-sec-test-build-property", secData)
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-property").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-great-application"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
+ //
+ // t.Run("Build time property from Secret as property file", func(t *testing.T) {
+ // var secData = make(map[string]string)
+ // secData["my.properties"] = "quarkus.application.name=my-awsome-application"
+ // CreatePlainTextSecret(ns, "my-sec-test-build-properties", secData)
+ //
+ // Expect(KamelRunWithID(operatorID, ns, "./files/build-property-file-route.groovy", "--build-property", "secret:my-sec-test-build-properties").Execute()).To(Succeed())
+ // Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ // Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ // Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-awsome-application"))
+ // Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ // })
})
}
diff --git a/e2e/namespace/install/cli/run_test.go b/e2e/namespace/install/cli/run_test.go
index 472ad0552..1504401b4 100644
--- a/e2e/namespace/install/cli/run_test.go
+++ b/e2e/namespace/install/cli/run_test.go
@@ -39,159 +39,137 @@ import (
var sampleJar = "https://raw.githubusercontent.com/apache/camel-k/main/e2e/global/common/traits/files/jvm/sample-1.0.jar"
-func operatorID(ns string) string {
- return fmt.Sprintf("camel-k-%s", ns)
-}
-
-func installWithID(ns string) {
- Expect(KamelInstallWithID(operatorID(ns), ns).Execute()).To(Succeed())
- Eventually(OperatorPod(ns)).ShouldNot(BeNil())
- Eventually(PlatformPhase(ns), TestTimeoutLong).Should(Equal(v1.IntegrationPlatformPhaseReady))
-}
-
-func TestKamelCLIRunGitHubExampleJava(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns,
- "github:apache/camel-k/e2e/namespace/install/files/Java.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!"))
- })
-}
-
-func TestKamelCLIRunGitHubExampleJavaRaw(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns,
- "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/files/Java.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!"))
- })
-}
-
-func TestKamelCLIRunGitHubExampleJavaBranch(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns,
- "github:apache/camel-k/e2e/namespace/install/files/Java.java?branch=main").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!"))
- })
-}
-
-func TestKamelCLIRunGitHubExampleGistID(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- name := "github-gist-id"
- Expect(KamelRunWithID(operatorID(ns), ns, "--name", name,
- "gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
- })
-}
-
-func TestKamelCLIRunGitHubExampleGistURL(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- name := "github-gist-url"
- Expect(KamelRunWithID(operatorID(ns), ns, "--name", name,
- "https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
- })
-}
-
-func TestKamelCLIRunAndUpdate(t *testing.T) {
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- name := "run"
- Expect(KamelRunWithID(operatorID(ns), ns, "files/run.yaml", "--name", name).Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic default"))
-
- // Re-run the Integration with an updated configuration
- Expect(KamelRunWithID(operatorID(ns), ns, "files/run.yaml", "--name", name, "-p", "property=value").Execute()).
- To(Succeed())
-
- // Check the Deployment has progressed successfully
- Eventually(DeploymentCondition(ns, name, appsv1.DeploymentProgressing), TestTimeoutShort).
- Should(MatchFields(IgnoreExtras, Fields{
- "Status": Equal(corev1.ConditionTrue),
- "Reason": Equal("NewReplicaSetAvailable"),
- }))
-
- // Check the new configuration is taken into account
- Eventually(IntegrationPodPhase(ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
- Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic value"))
-
- })
-}
-
-/*
- * TODO
- * The dependency cannot be read by maven while building. See #3708
- *
- * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
- */
-func TestKamelCLIRunWithHttpDependency(t *testing.T) {
- if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
- t.Skip("WARNING: Test marked as problematic ... skipping")
- }
- WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- fmt.Println("OperatorID: ", operatorID(ns))
- Expect(KamelRunWithID(operatorID(ns), ns, "../../../global/common/traits/files/jvm/Classpath.java",
- "-d", sampleJar, "--verbose",
- ).Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
- })
-}
-
-/*
- * TODO
- * The dependency cannot be read by maven while building. See #3708
- *
- * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
- */
-func TestKamelCLIRunHttpDependencyUsingOptions(t *testing.T) {
- if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
- t.Skip("WARNING: Test marked as problematic ... skipping")
- }
+func TestKamelCLIRun(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- installWithID(ns)
-
- Expect(KamelRunWithID(operatorID(ns), ns, "../../../global/common/traits/files/jvm/Classpath.java",
- "-d", sampleJar, "--verbose",
- "-d", "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/cli/files/Java.java|targetPath=/tmp/foo",
- ).Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
+ operatorID := fmt.Sprintf("camel-k-%s", ns)
+ Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())
+
+ 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())
+ 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!"))
+ 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()).
+ 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!"))
+ 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())
+ 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!"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ })
+
+ t.Run("Gist (ID)", func(t *testing.T) {
+ name := "github-gist-id"
+ Expect(KamelRunWithID(operatorID, ns, "--name", name,
+ "gist:e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ })
+
+ t.Run("Gist (URL)", func(t *testing.T) {
+ name := "github-gist-url"
+ Expect(KamelRunWithID(operatorID, ns, "--name", name,
+ "https://gist.github.com/lburgazzoli/e2c3f9a5fd0d9e79b21b04809786f17a").Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Tick!"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ })
+
+ // Clean up
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ })
+
+ t.Run("Run and update", func(t *testing.T) {
+ name := "run"
+ Expect(KamelRunWithID(operatorID, ns, "files/run.yaml", "--name", name).Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic default"))
+
+ // Re-run the Integration with an updated configuration
+ Expect(KamelRunWithID(operatorID, ns, "files/run.yaml", "--name", name, "-p", "property=value").Execute()).
+ To(Succeed())
+
+ // Check the Deployment has progressed successfully
+ Eventually(DeploymentCondition(ns, name, appsv1.DeploymentProgressing), TestTimeoutShort).
+ Should(MatchFields(IgnoreExtras, Fields{
+ "Status": Equal(corev1.ConditionTrue),
+ "Reason": Equal("NewReplicaSetAvailable"),
+ }))
+
+ // Check the new configuration is taken into account
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Magic value"))
+
+ // Clean up
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ })
+
+ /*
+ * TODO
+ * The dependency cannot be read by maven while building. See #3708
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
+ t.Run("Run with http dependency", func(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+ Expect(KamelRunWithID(operatorID, ns, "../../../global/common/traits/files/jvm/Classpath.java",
+ "-d", sampleJar,
+ ).Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ })
+
+ /*
+ * TODO
+ * The dependency cannot be read by maven while building. See #3708
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
+ t.Run("Run with http dependency using options", func(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+ Expect(KamelRunWithID(operatorID, ns, "../../../global/common/traits/files/jvm/Classpath.java",
+ "-d", sampleJar,
+ "-d", "https://raw.githubusercontent.com/apache/camel-k/main/e2e/namespace/install/cli/files/Java.java|targetPath=/tmp/foo",
+ ).Execute()).To(Succeed())
+ Eventually(IntegrationPodPhase(ns, "classpath"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, "classpath", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "classpath"), TestTimeoutShort).Should(ContainSubstring("Hello World!"))
+ Eventually(DeleteIntegrations(ns), TestTimeoutLong).Should(Equal(0))
+ })
})
}
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 7cee2a0b8..4edd2968d 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -850,6 +850,24 @@ func IntegrationCronJob(ns string, name string) func() *batchv1.CronJob {
}
}
+func Integrations(ns string) func() *v1.IntegrationList {
+ return func() *v1.IntegrationList {
+ lst := v1.NewIntegrationList()
+ if err := TestClient().List(TestContext, &lst, ctrl.InNamespace(ns)); err != nil {
+ failTest(err)
+ }
+
+ return &lst
+ }
+}
+
+func NumIntegrations(ns string) func() int {
+ return func() int {
+ lst := Integrations(ns)()
+ return len(lst.Items)
+ }
+}
+
func Integration(ns string, name string) func() *v1.Integration {
return func() *v1.Integration {
it := v1.NewIntegration(ns, name)
@@ -1167,6 +1185,21 @@ func DeleteKits(ns string) error {
return nil
}
+func DeleteIntegrations(ns string) func() (int, error) {
+ return func() (int, error) {
+ integrations := Integrations(ns)()
+ if len(integrations.Items) == 0 {
+ return 0, nil
+ }
+
+ if err := Kamel("delete", "--all", "-n", ns).Execute(); err != nil {
+ return 0, err
+ }
+
+ return NumIntegrations(ns)(), nil
+ }
+}
+
func OperatorImage(ns string) func() string {
return func() string {
pod := OperatorPod(ns)()