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/05/25 13:48:30 UTC

[camel-k] branch main updated (c5e0efece -> 573e969b7)

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

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


    from c5e0efece Never stale a bug issue
     new a092e8b7f test(e2e): add test for 'kamel run --dev' in a warmed-up environment
     new 573e969b7 fix(e2e): stabilise service trait test

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 e2e/common/cli/dev_mode_test.go   | 46 +++++++++++++++++++++++++++++++++++++++
 e2e/common/traits/service_test.go |  5 ++---
 e2e/support/test_support.go       | 10 +++++++++
 3 files changed, 58 insertions(+), 3 deletions(-)


[camel-k] 01/02: test(e2e): add test for 'kamel run --dev' in a warmed-up environment

Posted by ts...@apache.org.
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

commit a092e8b7f6085683fe1be9d4b1fd6c34401c18dc
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Wed May 25 13:55:15 2022 +0900

    test(e2e): add test for 'kamel run --dev' in a warmed-up environment
    
    Fix #3211
---
 e2e/common/cli/dev_mode_test.go | 46 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/e2e/common/cli/dev_mode_test.go b/e2e/common/cli/dev_mode_test.go
index db7fd7309..180b1565d 100644
--- a/e2e/common/cli/dev_mode_test.go
+++ b/e2e/common/cli/dev_mode_test.go
@@ -29,9 +29,11 @@ import (
 	"io/ioutil"
 	"os"
 	"testing"
+	"time"
 
 	. "github.com/onsi/gomega"
 	"github.com/stretchr/testify/assert"
+	corev1 "k8s.io/api/core/v1"
 
 	. "github.com/apache/camel-k/e2e/support"
 	"github.com/apache/camel-k/e2e/support/util"
@@ -144,5 +146,49 @@ func TestRunDevMode(t *testing.T) {
 			// When the integration is deleted, then, also the autogenerated configmaps must be cleaned
 			Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
 		})
+
+		// This test makes sure that `kamel run --dev` runs in seconds after initial build is
+		// already done for the same integration.
+		t.Run("dev mode rebuild in seconds", func(t *testing.T) {
+			/*
+			 * !!! NOTE !!!
+			 * If you find this test flaky, instead of thinking it as simply unstable, investigate
+			 * why it does not finish in a few seconds and remove the bottlenecks which are lagging
+			 * the integration startup.
+			 */
+			RegisterTestingT(t)
+
+			// First run (warm up)
+			Expect(Kamel("run", "-n", ns, "files/yaml.yaml").Execute()).To(Succeed())
+			Eventually(IntegrationPodPhase(ns, "yaml"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+			Eventually(IntegrationLogs(ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+			Expect(Kamel("delete", "yaml", "-n", ns).Execute()).To(Succeed())
+			Eventually(Integration(ns, "yaml")).Should(BeNil())
+			Eventually(IntegrationPod(ns, "yaml")).Should(BeNil())
+
+			// Second run (rebuild)
+			ctx, cancel := context.WithCancel(TestContext)
+			defer cancel()
+			piper, pipew := io.Pipe()
+			defer pipew.Close()
+			defer piper.Close()
+
+			file := util.MakeTempCopy(t, "files/yaml.yaml")
+
+			kamelRun := KamelWithContext(ctx, "run", "-n", ns, file, "--dev")
+			kamelRun.SetOut(pipew)
+
+			logScanner := util.NewLogScanner(ctx, piper, `integration "yaml" in phase Running`, "Magicstring!")
+
+			args := os.Args
+			defer func() { os.Args = args }()
+			os.Args = []string{"kamel", "run", "-n", ns, file, "--dev"}
+			go kamelRun.Execute()
+
+			// Second run should start up within a few seconds
+			timeout := 10 * time.Second
+			Eventually(logScanner.IsFound(`integration "yaml" in phase Running`), timeout).Should(BeTrue())
+			Eventually(logScanner.IsFound("Magicstring!"), timeout).Should(BeTrue())
+		})
 	})
 }


[camel-k] 02/02: fix(e2e): stabilise service trait test

Posted by ts...@apache.org.
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

commit 573e969b7010e27d97e72bdd1bfa92c89b13d61d
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Wed May 25 18:21:26 2022 +0900

    fix(e2e): stabilise service trait test
---
 e2e/common/traits/service_test.go |  5 ++---
 e2e/support/test_support.go       | 10 ++++++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/e2e/common/traits/service_test.go b/e2e/common/traits/service_test.go
index 0ee3569c6..a8016e1ba 100644
--- a/e2e/common/traits/service_test.go
+++ b/e2e/common/traits/service_test.go
@@ -52,9 +52,8 @@ func TestServiceTrait(t *testing.T) {
 				"-t", "service.enabled=true",
 				"-t", "service.node-port=true").Execute()).To(Succeed())
 			Eventually(IntegrationPodPhase(ns, "platform-http-server"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
-			service := Service(ns, "platform-http-server")
-			Eventually(service, TestTimeoutShort).ShouldNot(BeNil())
-			Expect(service().Spec.Type).Should(Equal(corev1.ServiceTypeNodePort))
+			Eventually(Service(ns, "platform-http-server"), TestTimeoutShort).ShouldNot(BeNil())
+			Eventually(ServiceType(ns, "platform-http-server"), TestTimeoutShort).Should(Equal(corev1.ServiceTypeNodePort))
 
 			Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
 		})
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 4f95e83bb..f337ec7a3 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -558,6 +558,16 @@ func Service(ns string, name string) func() *corev1.Service {
 	}
 }
 
+func ServiceType(ns string, name string) func() corev1.ServiceType {
+	return func() corev1.ServiceType {
+		svc := Service(ns, name)()
+		if svc == nil {
+			return ""
+		}
+		return svc.Spec.Type
+	}
+}
+
 func Route(ns string, name string) func() *routev1.Route {
 	return func() *routev1.Route {
 		route := routev1.Route{}