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/24 08:30:48 UTC

[camel-k] 01/03: chore(e2e): native test - add warm up before native build testing

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

tsato pushed a commit to branch release-1.8.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 507276b6ad96fd873c8120c60ed28180fffffc92
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Thu Sep 1 14:54:46 2022 +0900

    chore(e2e): native test - add warm up before native build testing
---
 e2e/native/native_test.go   | 22 +++++++++++++++++++++-
 e2e/support/test_support.go | 17 +++++++++++++++--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/e2e/native/native_test.go b/e2e/native/native_test.go
index 72580ba4e..a5a871ecb 100644
--- a/e2e/native/native_test.go
+++ b/e2e/native/native_test.go
@@ -54,7 +54,27 @@ func TestNativeIntegrations(t *testing.T) {
 			).Execute()).To(Succeed())
 
 			Eventually(IntegrationPhase(ns, name)).Should(Equal(v1.IntegrationPhaseError))
-			Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionKitAvailable)).Should(Equal(corev1.ConditionFalse))
+			Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionKitAvailable)).
+				Should(Equal(corev1.ConditionFalse))
+
+				// Clean up
+			Expect(Kamel("delete", name, "-n", ns).Execute()).To(Succeed())
+		})
+
+		t.Run("warm up before native build testing", func(t *testing.T) {
+			// The following native build test is under tight time constraints, so here it runs
+			// a warm up testing to make sure necessary jars are already downloaded.
+			name := "warm-up-yaml"
+			Expect(Kamel("run", "-n", ns, "yaml.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("Magicstring!"))
+
+			// Clean up
+			Expect(Kamel("delete", name, "-n", ns).Execute()).To(Succeed())
+			Expect(DeleteKits(ns)).To(Succeed())
 		})
 
 		t.Run("automatic rollout deployment from fast-jar to native kit", func(t *testing.T) {
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 1f507b8c1..67afbc8d7 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -899,6 +899,20 @@ func Kits(ns string, options ...interface{}) func() []v1.IntegrationKit {
 	}
 }
 
+func DeleteKits(ns string) error {
+	kits := Kits(ns)()
+	if len(kits) == 0 {
+		return nil
+	}
+	for _, kit := range kits {
+		if err := TestClient().Delete(TestContext, &kit); err != nil {
+			return err
+		}
+	}
+
+	return nil
+}
+
 func OperatorImage(ns string) func() string {
 	return func() string {
 		pod := OperatorPod(ns)()
@@ -1142,8 +1156,7 @@ func DeletePlatform(ns string) func() bool {
 		if pl == nil {
 			return true
 		}
-		err := TestClient().Delete(TestContext, pl)
-		if err != nil {
+		if err := TestClient().Delete(TestContext, pl); err != nil {
 			log.Error(err, "Got error while deleting the platform")
 		}
 		return false