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 c3f1f60ba2bf6c2dbba3f57c45374711e7d91ac1
Author: Tadayoshi Sato <sato.tadayo...@gmail.com>
AuthorDate: Tue Mar 1 14:25:14 2022 +0900

    test(e2e): add test for 'kamel local run --integration-directory'
    
    Fix #2075
---
 e2e/local/local_run_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/e2e/local/local_run_test.go b/e2e/local/local_run_test.go
index 349f478..6eeb00d 100644
--- a/e2e/local/local_run_test.go
+++ b/e2e/local/local_run_test.go
@@ -25,8 +25,8 @@ import (
        "io"
        "testing"
 
-       "github.com/golangplus/testing/assert"
        . "github.com/onsi/gomega"
+       "github.com/stretchr/testify/assert"
 
        . "github.com/apache/camel-k/e2e/support"
        "github.com/apache/camel-k/e2e/support/util"
@@ -57,7 +57,7 @@ func TestLocalRun(t *testing.T) {
        Eventually(logScanner.IsFound("Magicstring!"), 
TestTimeoutMedium).Should(BeTrue())
 }
 
-func TestLocalContainerRun(t *testing.T) {
+func TestLocalRunContainerize(t *testing.T) {
        RegisterTestingT(t)
 
        ctx, cancel := context.WithCancel(TestContext)
@@ -81,3 +81,44 @@ func TestLocalContainerRun(t *testing.T) {
 
        Eventually(logScanner.IsFound("Magicstring!"), 
TestTimeoutMedium).Should(BeTrue())
 }
+
+func TestLocalRunIntegrationDirectory(t *testing.T) {
+       RegisterTestingT(t)
+
+       ctx1, cancel1 := context.WithCancel(TestContext)
+       defer cancel1()
+
+       file := util.MakeTempCopy(t, "files/yaml.yaml")
+       dir := util.MakeTempDir(t)
+
+       kamelBuild := KamelWithContext(ctx1, "local", "build", file, 
"--integration-directory", dir)
+
+       go func() {
+               err := kamelBuild.Execute()
+               assert.NoError(t, err)
+               cancel1()
+       }()
+
+       Eventually(dir+"/dependencies", TestTimeoutShort).Should(BeADirectory())
+       Eventually(dir+"/properties", TestTimeoutShort).Should(BeADirectory())
+       Eventually(dir+"/routes/yaml.yaml", 
TestTimeoutShort).Should(BeAnExistingFile())
+
+       ctx2, cancel2 := context.WithCancel(TestContext)
+       defer cancel2()
+       piper, pipew := io.Pipe()
+       defer pipew.Close()
+       defer piper.Close()
+
+       kamelRun := KamelWithContext(ctx2, "local", "run", 
"--integration-directory", dir)
+       kamelRun.SetOut(pipew)
+
+       logScanner := util.NewLogScanner(ctx2, piper, "Magicstring!")
+
+       go func() {
+               err := kamelRun.Execute()
+               assert.NoError(t, err)
+               cancel2()
+       }()
+
+       Eventually(logScanner.IsFound("Magicstring!"), 
TestTimeoutMedium).Should(BeTrue())
+}

Reply via email to