You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "spatnity (via GitHub)" <gi...@apache.org> on 2023/10/05 09:22:23 UTC

[PR] Camel-k-runtime tests is failing in Quarkus platform #5319 [camel-quarkus]

spatnity opened a new pull request, #5404:
URL: https://github.com/apache/camel-quarkus/pull/5404

   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Camel-k-runtime tests is failing in Quarkus platform #5319 [camel-quarkus]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #5404:
URL: https://github.com/apache/camel-quarkus/pull/5404#discussion_r1347463316


##########
integration-tests/camel-k-runtime/src/test/java/org/apache/camel/quarkus/k/it/RuntimeTest.java:
##########
@@ -48,6 +61,51 @@ public void inspect() {
                 .isEqualTo(Application.NoRoutesCollector.class.getName());
     }
 
+    public static class Resources implements QuarkusTestResourceLifecycleManager {
+        private static final Path TEMP_DIR = Paths.get("target/test-classes/camel-k-runtime"); // Specify your temporary directory here
+
+        @Override
+        public Map<String, String> start() {
+            Path confd = TEMP_DIR.resolve("conf.d");
+
+            for (int i = 1; i <= 3; i++) {
+                String path = String.format("00%d", i);
+                Path confdSubDir = confd.resolve(path);
+                confdSubDir.toFile().mkdirs();
+
+                String file = i < 3 ? "conf.properties" : "flat-property";
+                copyResourceToTemp("conf.d/" + path + "/" + file, confdSubDir.resolve(file).toAbsolutePath());
+            }
+
+            Path confProperties = TEMP_DIR.resolve("conf.properties");
+            copyResourceToTemp("conf.properties", confProperties.toAbsolutePath());
+
+            return Map.of(
+                    "CAMEL_K_CONF", confProperties.toAbsolutePath().toString(),
+                    "CAMEL_K_CONF_D", confd.toAbsolutePath().toString());
+        }
+
+        private void copyResourceToTemp(String resourceName, Path destination) {
+            try (InputStream stream = getClass().getClassLoader().getResourceAsStream(resourceName)) {
+                Files.copy(stream, destination, StandardCopyOption.REPLACE_EXISTING);
+            } catch (Exception e) {
+                throw new RuntimeException("Failed to copy resource " + resourceName + " to temporary directory", e);
+            }
+        }
+
+        @Override
+        public void stop() {
+            try {
+                Files.walk(TEMP_DIR)

Review Comment:
   Those kinds of delete, we can maybe write less code ala:
   https://github.com/apache/camel-quarkus/blob/main/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTestResource.java#L54



##########
integration-tests/camel-k-runtime/src/test/java/org/apache/camel/quarkus/k/it/RuntimeTest.java:
##########
@@ -48,6 +61,51 @@ public void inspect() {
                 .isEqualTo(Application.NoRoutesCollector.class.getName());
     }
 
+    public static class Resources implements QuarkusTestResourceLifecycleManager {
+        private static final Path TEMP_DIR = Paths.get("target/test-classes/camel-k-runtime"); // Specify your temporary directory here
+
+        @Override
+        public Map<String, String> start() {
+            Path confd = TEMP_DIR.resolve("conf.d");
+
+            for (int i = 1; i <= 3; i++) {
+                String path = String.format("00%d", i);
+                Path confdSubDir = confd.resolve(path);
+                confdSubDir.toFile().mkdirs();
+
+                String file = i < 3 ? "conf.properties" : "flat-property";
+                copyResourceToTemp("conf.d/" + path + "/" + file, confdSubDir.resolve(file).toAbsolutePath());
+            }
+
+            Path confProperties = TEMP_DIR.resolve("conf.properties");
+            copyResourceToTemp("conf.properties", confProperties.toAbsolutePath());
+
+            return Map.of(
+                    "CAMEL_K_CONF", confProperties.toAbsolutePath().toString(),
+                    "CAMEL_K_CONF_D", confd.toAbsolutePath().toString());
+        }
+
+        private void copyResourceToTemp(String resourceName, Path destination) {
+            try (InputStream stream = getClass().getClassLoader().getResourceAsStream(resourceName)) {
+                Files.copy(stream, destination, StandardCopyOption.REPLACE_EXISTING);
+            } catch (Exception e) {
+                throw new RuntimeException("Failed to copy resource " + resourceName + " to temporary directory", e);
+            }
+        }
+
+        @Override
+        public void stop() {
+            try {
+                Files.walk(TEMP_DIR)

Review Comment:
   it's not blocking to merge by the way



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Camel-k-runtime tests is failing in Quarkus platform #5319 [camel-quarkus]

Posted by "spatnity (via GitHub)" <gi...@apache.org>.
spatnity commented on PR #5404:
URL: https://github.com/apache/camel-quarkus/pull/5404#issuecomment-1748470198

   #5319 Can be fixed when Camel Quarkus 3.5.0-SNAPSHOT is released.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Camel-k-runtime tests is failing in Quarkus platform #5319 [camel-quarkus]

Posted by "spatnity (via GitHub)" <gi...@apache.org>.
spatnity commented on code in PR #5404:
URL: https://github.com/apache/camel-quarkus/pull/5404#discussion_r1348264052


##########
integration-tests/camel-k-runtime/src/test/java/org/apache/camel/quarkus/k/it/RuntimeTest.java:
##########
@@ -48,6 +61,51 @@ public void inspect() {
                 .isEqualTo(Application.NoRoutesCollector.class.getName());
     }
 
+    public static class Resources implements QuarkusTestResourceLifecycleManager {
+        private static final Path TEMP_DIR = Paths.get("target/test-classes/camel-k-runtime"); // Specify your temporary directory here
+
+        @Override
+        public Map<String, String> start() {
+            Path confd = TEMP_DIR.resolve("conf.d");
+
+            for (int i = 1; i <= 3; i++) {
+                String path = String.format("00%d", i);
+                Path confdSubDir = confd.resolve(path);
+                confdSubDir.toFile().mkdirs();
+
+                String file = i < 3 ? "conf.properties" : "flat-property";
+                copyResourceToTemp("conf.d/" + path + "/" + file, confdSubDir.resolve(file).toAbsolutePath());
+            }
+
+            Path confProperties = TEMP_DIR.resolve("conf.properties");
+            copyResourceToTemp("conf.properties", confProperties.toAbsolutePath());
+
+            return Map.of(
+                    "CAMEL_K_CONF", confProperties.toAbsolutePath().toString(),
+                    "CAMEL_K_CONF_D", confd.toAbsolutePath().toString());
+        }
+
+        private void copyResourceToTemp(String resourceName, Path destination) {
+            try (InputStream stream = getClass().getClassLoader().getResourceAsStream(resourceName)) {
+                Files.copy(stream, destination, StandardCopyOption.REPLACE_EXISTING);
+            } catch (Exception e) {
+                throw new RuntimeException("Failed to copy resource " + resourceName + " to temporary directory", e);
+            }
+        }
+
+        @Override
+        public void stop() {
+            try {
+                Files.walk(TEMP_DIR)

Review Comment:
   Oh okay, noted. Thankyou @aldettinger 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Camel-k-runtime tests is failing in Quarkus platform #5319 [camel-quarkus]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #5404:
URL: https://github.com/apache/camel-quarkus/pull/5404#issuecomment-1748948375

   It's a shame we don't have a IOUtils like one liner to save a resource hierarchy to files. At least, nothing come on top of mind.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Camel-k-runtime tests is failing in Quarkus platform #5319 [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #5404:
URL: https://github.com/apache/camel-quarkus/pull/5404#discussion_r1348381558


##########
integration-tests/camel-k-runtime/src/test/java/org/apache/camel/quarkus/k/it/RuntimeTest.java:
##########
@@ -48,6 +61,51 @@ public void inspect() {
                 .isEqualTo(Application.NoRoutesCollector.class.getName());
     }
 
+    public static class Resources implements QuarkusTestResourceLifecycleManager {
+        private static final Path TEMP_DIR = Paths.get("target/test-classes/camel-k-runtime"); // Specify your temporary directory here
+
+        @Override
+        public Map<String, String> start() {
+            Path confd = TEMP_DIR.resolve("conf.d");
+
+            for (int i = 1; i <= 3; i++) {
+                String path = String.format("00%d", i);
+                Path confdSubDir = confd.resolve(path);
+                confdSubDir.toFile().mkdirs();
+
+                String file = i < 3 ? "conf.properties" : "flat-property";
+                copyResourceToTemp("conf.d/" + path + "/" + file, confdSubDir.resolve(file).toAbsolutePath());
+            }
+
+            Path confProperties = TEMP_DIR.resolve("conf.properties");
+            copyResourceToTemp("conf.properties", confProperties.toAbsolutePath());
+
+            return Map.of(
+                    "CAMEL_K_CONF", confProperties.toAbsolutePath().toString(),
+                    "CAMEL_K_CONF_D", confd.toAbsolutePath().toString());
+        }
+
+        private void copyResourceToTemp(String resourceName, Path destination) {
+            try (InputStream stream = getClass().getClassLoader().getResourceAsStream(resourceName)) {
+                Files.copy(stream, destination, StandardCopyOption.REPLACE_EXISTING);
+            } catch (Exception e) {
+                throw new RuntimeException("Failed to copy resource " + resourceName + " to temporary directory", e);
+            }
+        }
+
+        @Override
+        public void stop() {
+            try {
+                Files.walk(TEMP_DIR)

Review Comment:
   Let's follow up with another PR for this if needed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Camel-k-runtime tests is failing in Quarkus platform #5319 [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton merged PR #5404:
URL: https://github.com/apache/camel-quarkus/pull/5404


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org