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/25 08:15:21 UTC

[camel-k] 02/07: 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.10.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 43eb51604198e847c5e1dbf0c6f361eb09487074
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/namespace/native/native_test.go | 22 +++++++++++++++++++++-
 e2e/support/test_support.go         | 17 +++++++++++++++--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/e2e/namespace/native/native_test.go b/e2e/namespace/native/native_test.go
index f8d5fec91..20d4f9fa0 100644
--- a/e2e/namespace/native/native_test.go
+++ b/e2e/namespace/native/native_test.go
@@ -56,7 +56,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(KamelRunWithID(operatorID, ns, "files/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 59d064fa1..72c7e8d21 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -1107,6 +1107,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)()
@@ -1375,8 +1389,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