You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by ti...@apache.org on 2024/04/12 18:25:41 UTC

(incubator-kie-tools) branch main updated: kie-issues#1053: restore of e2e tests in kn workflow cli (#2209)

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

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new fe72c1459ae kie-issues#1053: restore of e2e tests in kn workflow cli (#2209)
fe72c1459ae is described below

commit fe72c1459ae11af06a9de58d005c44f98aa2cd50
Author: Dmitrii Tikhomirov <tr...@users.noreply.github.com>
AuthorDate: Fri Apr 12 11:25:35 2024 -0700

    kie-issues#1053: restore of e2e tests in kn workflow cli (#2209)
---
 .../kn-plugin-workflow/e2e-tests/helper_test.go    | 45 ++++++++++++++++++++++
 .../e2e-tests/quarkus_build_test.go                |  4 +-
 .../e2e-tests/quarkus_create_test.go               |  1 -
 .../e2e-tests/quarkus_run_test.go                  |  2 +-
 packages/kn-plugin-workflow/e2e-tests/run_test.go  |  2 +-
 packages/kn-plugin-workflow/package.json           |  2 +-
 .../pkg/command/quarkus/build.go                   |  2 +-
 .../testdata/pom1-expected.xml_no_auto_formatting  | 36 ++++++++---------
 .../testdata/pom1-input.xml_no_auto_formatting     | 20 +++++-----
 .../kn-plugin-workflow/pkg/metadata/constants.go   | 18 ++++-----
 10 files changed, 89 insertions(+), 43 deletions(-)

diff --git a/packages/kn-plugin-workflow/e2e-tests/helper_test.go b/packages/kn-plugin-workflow/e2e-tests/helper_test.go
index da2d8862ead..8d45777b8c6 100644
--- a/packages/kn-plugin-workflow/e2e-tests/helper_test.go
+++ b/packages/kn-plugin-workflow/e2e-tests/helper_test.go
@@ -172,3 +172,48 @@ func CleanUpAndChdirTemp(t *testing.T) {
 		os.Exit(1)
 	}
 }
+
+func AddSnapshotRepositoryDeclarationToPom(t *testing.T, projectDir string) {
+	VerifyFilesExist(t, projectDir, []string{"pom.xml"})
+	pomFilePath := filepath.Join(projectDir, "pom.xml")
+
+	file, err := os.Open(pomFilePath)
+	require.NoErrorf(t, err, "Expected nil error, got: %v", err)
+
+	content, err := io.ReadAll(file)
+	require.NoErrorf(t, err, "Expected nil error, got: %v", err)
+
+	err = file.Close()
+	require.NoErrorf(t, err, "Expected nil error, got: %v", err)
+
+	xml := string(content)
+	insertPosition := strings.Index(xml, "</profiles>") + len("</profiles>")
+
+	const repository = `
+    <repositories>
+        <repository>
+            <id>central</id>
+            <url>https://repo.maven.apache.org/maven2</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+        <repository>
+            <id>apache-kie</id>
+            <url>https://repository.apache.org/content/repositories/snapshots</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+    </repositories>`
+
+	modifiedXml := xml[:insertPosition] + repository + xml[insertPosition:]
+	err = os.WriteFile(pomFilePath, []byte(modifiedXml), 0644)
+	require.NoErrorf(t, err, "Expected nil error, got: %v", err)
+}
diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_build_test.go b/packages/kn-plugin-workflow/e2e-tests/quarkus_build_test.go
index 361984272c7..89e1837c4be 100644
--- a/packages/kn-plugin-workflow/e2e-tests/quarkus_build_test.go
+++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_build_test.go
@@ -123,7 +123,9 @@ func RunQuarkusBuildTest(t *testing.T, cfgTestInputQuarkusCreate CfgTestInputQua
 	require.NoErrorf(t, err, "Expected nil error, got %v", err)
 
 	// Run `quarkus build` command
-	_, err = ExecuteKnWorkflowQuarkus(transformQuarkusBuildCmdCfgToArgs(test.input)...)
+	args := transformQuarkusBuildCmdCfgToArgs(test.input);
+	AddSnapshotRepositoryDeclarationToPom(t, projectDir)
+	_, err = ExecuteKnWorkflowQuarkus(args...)
 	require.NoErrorf(t, err, "Expected nil error, got %v", err)
 
 	require.FileExists(t, filepath.Join("target", "kubernetes", "knative.yml"))
diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go b/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go
index 637b09f1332..782aca36ee7 100644
--- a/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go
+++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go
@@ -149,7 +149,6 @@ func RunQuarkusCreateTest(t *testing.T, test CfgTestInputQuarkusCreate) string {
 	require.NoErrorf(t, err, "Error reading workflow template: %v", err)
 	expectedFileContent := string(workflowFileData)
 	VerifyFileContent(t, workflowFilePath, expectedFileContent)
-
 	return projectName
 }
 
diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_run_test.go b/packages/kn-plugin-workflow/e2e-tests/quarkus_run_test.go
index 91b8c8a85a9..8645ec844a6 100644
--- a/packages/kn-plugin-workflow/e2e-tests/quarkus_run_test.go
+++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_run_test.go
@@ -109,7 +109,7 @@ func RunQuarkusRunTest(t *testing.T, cfgTestInputPrepareQuarkusCreateRun CfgTest
 	// Check if the project is successfully run and accessible within a specified time limit.
 	readyCheckURL := fmt.Sprintf("http://localhost:%s/q/health/ready", getRunQuarkusProjectPort(t, test))
 	pollInterval := 5 * time.Second
-	timeout := 4 * time.Minute
+	timeout := 10 * time.Minute
 	ready := make(chan bool)
 	t.Logf("Checking if project is ready at %s", readyCheckURL)
 	go common.PollReadyCheckURL(readyCheckURL, pollInterval, ready)
diff --git a/packages/kn-plugin-workflow/e2e-tests/run_test.go b/packages/kn-plugin-workflow/e2e-tests/run_test.go
index 2233cba85df..13a542b1e53 100644
--- a/packages/kn-plugin-workflow/e2e-tests/run_test.go
+++ b/packages/kn-plugin-workflow/e2e-tests/run_test.go
@@ -104,7 +104,7 @@ func RunRunTest(t *testing.T, cfgTestInputPrepareCreate CfgTestInputCreate, test
 	// Check if the project is successfully run and accessible within a specified time limit.
 	readyCheckURL := fmt.Sprintf("http://localhost:%s/q/health/ready", getRunProjectPort(t, test))
 	pollInterval := 5 * time.Second
-	timeout := 4 * time.Minute
+	timeout := 10 * time.Minute
 	ready := make(chan bool)
 	t.Logf("Checking if project is ready at %s", readyCheckURL)
 	go common.PollReadyCheckURL(readyCheckURL, pollInterval, ready)
diff --git a/packages/kn-plugin-workflow/package.json b/packages/kn-plugin-workflow/package.json
index d3c0a3538a1..a5595cd3e00 100644
--- a/packages/kn-plugin-workflow/package.json
+++ b/packages/kn-plugin-workflow/package.json
@@ -22,7 +22,7 @@
     "build:darwin:arm": "pnpm setup:env make build-darwin-arm64",
     "build:dev": "rimraf dist && pnpm build",
     "build:linux": "pnpm setup:env make build-linux-amd64",
-    "build:prod": "rimraf dist && run-script-os && pnpm test ",
+    "build:prod": "rimraf dist && run-script-os && pnpm test && pnpm test:e2e",
     "build:prod:darwin": "rimraf dist && pnpm setup:env make build-all",
     "build:prod:linux": "rimraf dist && pnpm setup:env make build-all",
     "build:prod:win32": "rimraf dist && pnpm setup:env:win32 make build-all",
diff --git a/packages/kn-plugin-workflow/pkg/command/quarkus/build.go b/packages/kn-plugin-workflow/pkg/command/quarkus/build.go
index 53403796dd1..afcbab66f90 100644
--- a/packages/kn-plugin-workflow/pkg/command/quarkus/build.go
+++ b/packages/kn-plugin-workflow/pkg/command/quarkus/build.go
@@ -233,7 +233,7 @@ func runBuildImage(cfg BuildCmdConfig) (out string, err error) {
 	builderConfig := getBuilderConfig(cfg)
 	executableName := getExecutableNameConfig(cfg)
 
-	build := common.ExecCommand("mvn", "package",
+	build := common.ExecCommand("mvn", "-B", "package",
 		skipTestsConfig,
 		"-Dquarkus.kubernetes.deployment-target=knative",
 		fmt.Sprintf("-Dquarkus.knative.name=%s", name),
diff --git a/packages/kn-plugin-workflow/pkg/command/quarkus/testdata/pom1-expected.xml_no_auto_formatting b/packages/kn-plugin-workflow/pkg/command/quarkus/testdata/pom1-expected.xml_no_auto_formatting
index ccd157c3d0e..ae777190d86 100644
--- a/packages/kn-plugin-workflow/pkg/command/quarkus/testdata/pom1-expected.xml_no_auto_formatting
+++ b/packages/kn-plugin-workflow/pkg/command/quarkus/testdata/pom1-expected.xml_no_auto_formatting
@@ -60,44 +60,44 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-addons-quarkus-knative-eventing</artifactId>
+            <groupId>org.kie</groupId>
+            <artifactId>kie-addons-quarkus-knative-eventing</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-addons-quarkus-source-files</artifactId>
+            <groupId>org.kie</groupId>
+            <artifactId>kie-addons-quarkus-source-files</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-quarkus-serverless-workflow-devui</artifactId>
+            <groupId>org.apache.kie.sonataflow</groupId>
+            <artifactId>sonataflow-quarkus-devui</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
+            <groupId>org.kie</groupId>
             <artifactId>kogito-addons-quarkus-data-index-inmemory</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-quarkus-serverless-workflow</artifactId>
+            <groupId>org.apache.kie.sonataflow</groupId>
+            <artifactId>sonataflow-quarkus</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-addons-quarkus-knative-eventing</artifactId>
+            <groupId>org.kie</groupId>
+            <artifactId>kie-addons-quarkus-knative-eventing</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-addons-quarkus-source-files</artifactId>
+            <groupId>org.kie</groupId>
+            <artifactId>kie-addons-quarkus-source-files</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-quarkus-serverless-workflow-devui</artifactId>
+            <groupId>org.apache.kie.sonataflow</groupId>
+            <artifactId>sonataflow-quarkus-devui</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
+            <groupId>org.kie</groupId>
             <artifactId>kogito-addons-quarkus-data-index-inmemory</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.kie.kogito</groupId>
-            <artifactId>kogito-quarkus-serverless-workflow</artifactId>
+            <groupId>org.apache.kie.sonataflow</groupId>
+            <artifactId>sonataflow-quarkus</artifactId>
         </dependency>
     </dependencies>
     <build>
diff --git a/packages/kn-plugin-workflow/pkg/command/quarkus/testdata/pom1-input.xml_no_auto_formatting b/packages/kn-plugin-workflow/pkg/command/quarkus/testdata/pom1-input.xml_no_auto_formatting
index f2a46d611f8..f2050b01b73 100644
--- a/packages/kn-plugin-workflow/pkg/command/quarkus/testdata/pom1-input.xml_no_auto_formatting
+++ b/packages/kn-plugin-workflow/pkg/command/quarkus/testdata/pom1-input.xml_no_auto_formatting
@@ -55,24 +55,24 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.kie.kogito</groupId>
-      <artifactId>kogito-addons-quarkus-knative-eventing</artifactId>
+      <groupId>org.kie</groupId>
+      <artifactId>kie-addons-quarkus-knative-eventing</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.kie.kogito</groupId>
-      <artifactId>kogito-addons-quarkus-source-files</artifactId>
+      <groupId>org.kie</groupId>
+      <artifactId>kie-addons-quarkus-source-files</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.kie.kogito</groupId>
-      <artifactId>kogito-quarkus-serverless-workflow-devui</artifactId>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-quarkus-devui</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.kie.kogito</groupId>
+      <groupId>org.kie</groupId>
       <artifactId>kogito-addons-quarkus-data-index-inmemory</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.kie.kogito</groupId>
-      <artifactId>kogito-quarkus-serverless-workflow</artifactId>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-quarkus</artifactId>
     </dependency>
   </dependencies>
   <build>
@@ -147,4 +147,4 @@
       </properties>
     </profile>
   </profiles>
-</project>
\ No newline at end of file
+</project>
diff --git a/packages/kn-plugin-workflow/pkg/metadata/constants.go b/packages/kn-plugin-workflow/pkg/metadata/constants.go
index 7b7963c00cb..8dc3c610145 100644
--- a/packages/kn-plugin-workflow/pkg/metadata/constants.go
+++ b/packages/kn-plugin-workflow/pkg/metadata/constants.go
@@ -39,11 +39,11 @@ var KogitoBomDependency = Dependency{
 // KogitoDependencies defines the set of dependencies to be added to the pom.xml
 // of created and converted Quarkus projects.
 var KogitoDependencies = []Dependency{
-	{GroupId: "org.kie.kogito", ArtifactId: "kogito-addons-quarkus-knative-eventing"},
-	{GroupId: "org.kie.kogito", ArtifactId: "kogito-addons-quarkus-source-files"},
-	{GroupId: "org.kie.kogito", ArtifactId: "kogito-quarkus-serverless-workflow-devui"},
-	{GroupId: "org.kie.kogito", ArtifactId: "kogito-addons-quarkus-data-index-inmemory"},
-	{GroupId: "org.kie.kogito", ArtifactId: "kogito-quarkus-serverless-workflow"},
+	{GroupId: "org.kie", ArtifactId: "kie-addons-quarkus-knative-eventing"},
+	{GroupId: "org.kie", ArtifactId: "kie-addons-quarkus-source-files"},
+	{GroupId: "org.apache.kie.sonataflow", ArtifactId: "sonataflow-quarkus-devui"},
+	{GroupId: "org.kie", ArtifactId: "kogito-addons-quarkus-data-index-inmemory"},
+	{GroupId: "org.apache.kie.sonataflow", ArtifactId: "sonataflow-quarkus"},
 }
 
 const (
@@ -53,10 +53,10 @@ const (
 	QuarkusContainerImageJib                    = "quarkus-container-image-jib"
 	SmallryeHealth                              = "smallrye-health"
 	QuarkusContainerImageDocker                 = "quarkus-container-image-docker"
-	KogitoQuarkusServerlessWorkflowExtension    = "kogito-quarkus-serverless-workflow"
-	KogitoAddonsQuarkusKnativeEventingExtension = "kogito-addons-quarkus-knative-eventing"
-	KogitoQuarkusServerlessWorkflowDevUi        = "kogito-quarkus-serverless-workflow-devui"
-	KogitoAddonsQuarkusSourceFiles              = "kogito-addons-quarkus-source-files"
+	KogitoQuarkusServerlessWorkflowExtension    = "sonataflow-quarkus"
+	KogitoAddonsQuarkusKnativeEventingExtension = "kie-addons-quarkus-knative-eventing"
+	KogitoQuarkusServerlessWorkflowDevUi        = "sonataflow-quarkus-devui"
+	KogitoAddonsQuarkusSourceFiles              = "kie-addons-quarkus-source-files"
 	KogitoDataIndexInMemory                     = "kogito-addons-quarkus-data-index-inmemory"
 
 	JavaVersion       = 11


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org