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

mpochatkin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 8c6b8d2fd42 IGNITE-26933 Allow any files in compute classpath (#7591)
8c6b8d2fd42 is described below

commit 8c6b8d2fd42a50249723dc43679e91072a1ba844
Author: Vadim Pakhnushev <[email protected]>
AuthorDate: Tue Feb 24 16:21:24 2026 +0300

    IGNITE-26933 Allow any files in compute classpath (#7591)
---
 .../internal/deployunit/loader/UnitsClasspath.java |  4 +---
 modules/compute/jobs.gradle                        |  7 ++++++-
 .../internal/compute/ItComputeStandaloneTest.java  | 22 +++++++++++++++++-----
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git 
a/modules/code-deployment-classloader/src/main/java/org/apache/ignite/internal/deployunit/loader/UnitsClasspath.java
 
b/modules/code-deployment-classloader/src/main/java/org/apache/ignite/internal/deployunit/loader/UnitsClasspath.java
index 31f283e5606..a2a183b2be0 100644
--- 
a/modules/code-deployment-classloader/src/main/java/org/apache/ignite/internal/deployunit/loader/UnitsClasspath.java
+++ 
b/modules/code-deployment-classloader/src/main/java/org/apache/ignite/internal/deployunit/loader/UnitsClasspath.java
@@ -64,9 +64,7 @@ class UnitsClasspath {
 
         @Override
         public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) 
throws IOException {
-            if (Files.isDirectory(file) || file.toString().endsWith(".jar")) {
-                classpath.add(file.toAbsolutePath().toUri().toURL());
-            }
+            classpath.add(file.toAbsolutePath().toUri().toURL());
             return FileVisitResult.CONTINUE;
         }
 
diff --git a/modules/compute/jobs.gradle b/modules/compute/jobs.gradle
index e2789e61a90..b897fafdb22 100644
--- a/modules/compute/jobs.gradle
+++ b/modules/compute/jobs.gradle
@@ -36,7 +36,12 @@ registerJarTask(sourceSets.unit2, 'ignite-unit-test-job2')
 
 processIntegrationTestResources {
     into('units') {
-        from jobsJar
+        from(jobsJar) {
+            // Remove the jar extension from the jobs jar to verify the 
deployment of non-jar files.
+            rename {
+                'ignite-integration-test-jobs-1.0-SNAPSHOT.bin'
+            }
+        }
         from unit1Jar
         from unit2Jar
     }
diff --git 
a/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeStandaloneTest.java
 
b/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeStandaloneTest.java
index 290fa61208a..ea87573194c 100644
--- 
a/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeStandaloneTest.java
+++ 
b/modules/compute/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeStandaloneTest.java
@@ -28,15 +28,19 @@ import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutur
 import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
 import static org.awaitility.Awaitility.await;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
+import static org.hamcrest.Matchers.arrayWithSize;
 import static org.hamcrest.Matchers.containsInAnyOrder;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.everyItem;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 import static org.hamcrest.Matchers.nullValue;
 import static org.hamcrest.Matchers.oneOf;
-import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
@@ -69,6 +73,9 @@ class ItComputeStandaloneTest extends ItComputeBaseTest {
 
     private final List<DeploymentUnit> units = List.of(unit);
 
+    // The file is renamed in compile time to verify the deployment of non-jar 
files.
+    private static final String JAR_FILE_NAME = 
"ignite-integration-test-jobs-1.0-SNAPSHOT.bin";
+
     @Override
     protected int[] cmgMetastoreNodes() {
         return new int[] { 0, 1 }; // Majority will be 0, 1
@@ -76,7 +83,7 @@ class ItComputeStandaloneTest extends ItComputeBaseTest {
 
     @BeforeEach
     void deploy() throws IOException {
-        deployJar(unit.name(), unit.version(), 
"ignite-integration-test-jobs-1.0-SNAPSHOT.jar");
+        deployJar(unit.name(), unit.version(), JAR_FILE_NAME);
     }
 
     @AfterEach
@@ -275,7 +282,7 @@ class ItComputeStandaloneTest extends ItComputeBaseTest {
         assertThat(jobRes, containsString("name='jobs'"));
         assertThat(jobRes, containsString("version=1.0.0"));
         assertThat(jobRes, containsString("path="));
-        assertThat(jobRes.split(";").length, equalTo(2));
+        assertThat(jobRes.split(";"), arrayWithSize(2));
     }
 
     @Test
@@ -285,17 +292,22 @@ class ItComputeStandaloneTest extends ItComputeBaseTest {
 
         String jobRes = compute().execute(JobTarget.node(clusterNode(0)), job, 
null);
 
-        assertEquals("ignite-integration-test-jobs-1.0-SNAPSHOT.jar", jobRes);
+        assertThat(jobRes.split(";"), arrayContainingInAnyOrder(JAR_FILE_NAME, 
"test"));
     }
 
     private static void deployJar(String unitId, Version unitVersion, String 
jarName) throws IOException {
         IgniteDeployment deployment = deployment(0);
 
         try (InputStream jarStream = 
ItComputeStandaloneTest.class.getClassLoader().getResourceAsStream("units/" + 
jarName)) {
+            assertThat("Resource \"units/" + jarName + "\" doesn't exist", 
jarStream, is(notNullValue()));
+
             CompletableFuture<Boolean> deployed = deployment.deployAsync(
                     unitId,
                     unitVersion,
-                    new StreamDeploymentUnit(Map.of(jarName, jarStream)),
+                    new StreamDeploymentUnit(Map.of(
+                            jarName, jarStream,
+                            "test", new ByteArrayInputStream("Hello 
World!".getBytes()) // Pollute unit with non-jar file
+                    )),
                     new NodesToDeploy(MAJORITY)
             );
 

Reply via email to