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 2022/10/04 13:03:09 UTC

[camel-k] 01/02: [TEST] Extract shared functions

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit f6cbd1ea22fd1785d772c2854c57e53811986834
Author: Jan Bouska <jb...@redhat.com>
AuthorDate: Fri Sep 23 11:01:23 2022 +0200

    [TEST] Extract shared functions
---
 e2e/namespace/native/native_test.go         | 16 +----------
 e2e/namespace/native/native_test_support.go | 44 +++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/e2e/namespace/native/native_test.go b/e2e/namespace/native/native_test.go
index 6ca81734e..d13a03136 100644
--- a/e2e/namespace/native/native_test.go
+++ b/e2e/namespace/native/native_test.go
@@ -24,7 +24,6 @@ package native
 
 import (
 	"os"
-	"strings"
 	"testing"
 
 	. "github.com/onsi/gomega"
@@ -35,11 +34,6 @@ import (
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 )
 
-var (
-	withFastJarLayout = KitWithLabels(map[string]string{v1.IntegrationKitLayoutLabel: v1.IntegrationKitLayoutFastJar})
-	withNativeLayout  = KitWithLabels(map[string]string{v1.IntegrationKitLayoutLabel: v1.IntegrationKitLayoutNative})
-)
-
 func TestNativeIntegrations(t *testing.T) {
 	if os.Getenv("CAMEL_K_CLUSTER_OCP3") == "true" {
 		t.Skip("INFO: Skipping test as known to never pass on OCP3")
@@ -128,7 +122,7 @@ func TestNativeIntegrations(t *testing.T) {
 			// Check the Integration is still ready
 			Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
 			Eventually(IntegrationPod(ns, name), TestTimeoutShort).
-				Should(WithTransform(getContainerCommand(), MatchRegexp(".*camel-k-integration-.+-runner.*")))
+				Should(WithTransform(getContainerCommand(), MatchRegexp(".*camel-k-integration-\\d+\\.\\d+\\.\\d+[-A-Za-z]*-runner.*")))
 			Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
 				Should(Equal(corev1.ConditionTrue))
 
@@ -139,11 +133,3 @@ func TestNativeIntegrations(t *testing.T) {
 		Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 	})
 }
-
-func getContainerCommand() func(pod *corev1.Pod) string {
-	return func(pod *corev1.Pod) string {
-		cmd := strings.Join(pod.Spec.Containers[0].Command, " ")
-		cmd = cmd + strings.Join(pod.Spec.Containers[0].Args, " ")
-		return cmd
-	}
-}
diff --git a/e2e/namespace/native/native_test_support.go b/e2e/namespace/native/native_test_support.go
new file mode 100644
index 000000000..acd37558b
--- /dev/null
+++ b/e2e/namespace/native/native_test_support.go
@@ -0,0 +1,44 @@
+//go:build integration
+// +build integration
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package native
+
+import (
+	corev1 "k8s.io/api/core/v1"
+	"strings"
+
+	. "github.com/apache/camel-k/e2e/support"
+	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+)
+
+var (
+	withFastJarLayout = KitWithLabels(map[string]string{v1.IntegrationKitLayoutLabel: v1.IntegrationKitLayoutFastJar})
+	withNativeLayout  = KitWithLabels(map[string]string{v1.IntegrationKitLayoutLabel: v1.IntegrationKitLayoutNative})
+)
+
+func getContainerCommand() func(pod *corev1.Pod) string {
+	return func(pod *corev1.Pod) string {
+		cmd := strings.Join(pod.Spec.Containers[0].Command, " ")
+		cmd = cmd + strings.Join(pod.Spec.Containers[0].Args, " ")
+		return cmd
+	}
+}