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

apkhmv 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 c52d8de4fc IGNITE-19760 Create cluster status before deployment unit 
files uploading (#2207)
c52d8de4fc is described below

commit c52d8de4fcb1a10fa381865163d4c89609137183
Author: Mikhail <[email protected]>
AuthorDate: Sun Jun 25 14:47:14 2023 +0300

    IGNITE-19760 Create cluster status before deployment unit files uploading 
(#2207)
---
 .../internal/deployunit/DeploymentManagerImpl.java |  96 +++--------------
 .../internal/deployunit/IgniteDeployment.java      |  52 ++--------
 .../ignite/internal/deployunit/NodesToDeploy.java  | 114 +++++++++++++++++++++
 .../compute/util/DummyIgniteDeployment.java        |  16 ++-
 .../deployment/DeploymentManagementController.java |  11 +-
 .../internal/compute/ItComputeTestStandalone.java  |   5 +-
 .../ignite/internal/deployment/DeployFiles.java    |  22 ++--
 .../deployment/ItDeploymentUnitFailoverTest.java   |  10 +-
 .../internal/deployment/ItDeploymentUnitTest.java  |   5 +-
 9 files changed, 168 insertions(+), 163 deletions(-)

diff --git 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java
 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java
index 10d535ff00..e10abd3fd4 100644
--- 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java
+++ 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java
@@ -25,13 +25,11 @@ import static 
org.apache.ignite.internal.deployunit.DeploymentStatus.OBSOLETE;
 
 import java.nio.file.Path;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 import org.apache.ignite.compute.version.Version;
 import 
org.apache.ignite.internal.cluster.management.ClusterManagementGroupManager;
@@ -42,7 +40,6 @@ import 
org.apache.ignite.internal.deployunit.configuration.DeploymentConfigurati
 import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitAlreadyExistsException;
 import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitNotFoundException;
 import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitReadException;
-import 
org.apache.ignite.internal.deployunit.exception.InvalidNodesArgumentException;
 import org.apache.ignite.internal.deployunit.metastore.ClusterEventCallback;
 import 
org.apache.ignite.internal.deployunit.metastore.ClusterEventCallbackImpl;
 import 
org.apache.ignite.internal.deployunit.metastore.ClusterStatusWatchListener;
@@ -53,7 +50,6 @@ import 
org.apache.ignite.internal.deployunit.metastore.NodeStatusWatchListener;
 import 
org.apache.ignite.internal.deployunit.metastore.status.UnitClusterStatus;
 import org.apache.ignite.internal.logger.IgniteLogger;
 import org.apache.ignite.internal.logger.Loggers;
-import org.apache.ignite.network.ClusterNode;
 import org.apache.ignite.network.ClusterService;
 import org.jetbrains.annotations.Nullable;
 
@@ -162,40 +158,17 @@ public class DeploymentManagerImpl implements 
IgniteDeployment {
             String id,
             Version version,
             boolean force,
-            DeploymentUnit deploymentUnit,
-            InitialDeployMode deployMode
+            CompletableFuture<DeploymentUnit> deploymentUnit,
+            NodesToDeploy deployedNodes
     ) {
         checkId(id);
         Objects.requireNonNull(version);
         Objects.requireNonNull(deploymentUnit);
 
-        LOG.info("Deploying {}:{} on {}", id, version, deployMode);
-        return extractNodes(deployMode)
+        LOG.info("Deploying {}:{} on {}", id, version, deployedNodes);
+        return deployedNodes.extractNodes(cmgManager)
                 .thenCompose(nodesToDeploy ->
-                        doDeploy(id, version, force, deploymentUnit, 
nodesToDeploy,
-                                undeployed -> deployAsync(id, version, 
deploymentUnit, deployMode)
-                        )
-                );
-    }
-
-    @Override
-    public CompletableFuture<Boolean> deployAsync(
-            String id,
-            Version version,
-            boolean force,
-            DeploymentUnit deploymentUnit,
-            List<String> nodes
-    ) {
-        checkId(id);
-        Objects.requireNonNull(version);
-        Objects.requireNonNull(deploymentUnit);
-
-        LOG.info("Deploying {}:{} on {}", id, version, nodes);
-        return extractNodes(nodes)
-                .thenCompose(nodesToDeploy ->
-                        doDeploy(id, version, force, deploymentUnit, 
nodesToDeploy,
-                                undeployed -> deployAsync(id, version, 
deploymentUnit, nodes)
-                        )
+                        doDeploy(id, version, force, deploymentUnit, 
nodesToDeploy)
                 );
     }
 
@@ -203,18 +176,17 @@ public class DeploymentManagerImpl implements 
IgniteDeployment {
             String id,
             Version version,
             boolean force,
-            DeploymentUnit deploymentUnit,
-            Set<String> nodesToDeploy,
-            Function<Boolean, CompletableFuture<Boolean>> retryDeploy
+            CompletableFuture<DeploymentUnit> unitFuture,
+            Set<String> nodesToDeploy
     ) {
         return deploymentUnitStore.createClusterStatus(id, version, 
nodesToDeploy)
-                .thenCompose(success -> {
+                .thenCompose(success -> unitFuture.thenCompose(deploymentUnit 
-> {
                     if (success) {
                         return doDeploy(id, version, deploymentUnit, 
nodesToDeploy);
                     } else {
                         if (force) {
                             return undeployAsync(id, version)
-                                    .thenCompose(retryDeploy);
+                                    .thenCompose(u -> doDeploy(id, version, 
false, unitFuture, nodesToDeploy));
                         }
                         LOG.warn("Failed to deploy meta of unit " + id + ":" + 
version + " to metastore. "
                                 + "Already exists.");
@@ -222,10 +194,15 @@ public class DeploymentManagerImpl implements 
IgniteDeployment {
                                 new DeploymentUnitAlreadyExistsException(id,
                                         "Unit " + id + ":" + version + " 
already exists"));
                     }
-                });
+                }));
     }
 
-    private CompletableFuture<Boolean> doDeploy(String id, Version version, 
DeploymentUnit deploymentUnit, Set<String> nodesToDeploy) {
+    private CompletableFuture<Boolean> doDeploy(
+            String id,
+            Version version,
+            DeploymentUnit deploymentUnit,
+            Set<String> nodesToDeploy
+    ) {
         UnitContent unitContent;
         try {
             unitContent = UnitContent.readContent(deploymentUnit);
@@ -425,45 +402,4 @@ public class DeploymentManagerImpl implements 
IgniteDeployment {
     public DeploymentUnitAccessor deploymentUnitAccessor() {
         return deploymentUnitAccessor;
     }
-
-    private CompletableFuture<Set<String>> extractNodes(InitialDeployMode 
deployMode) {
-        switch (deployMode) {
-            case ALL:
-                return cmgManager.logicalTopology()
-                        .thenApply(snapshot -> snapshot.nodes().stream()
-                                .map(ClusterNode::name)
-                                .collect(Collectors.toUnmodifiableSet()));
-            case MAJORITY:
-            default:
-                return cmgManager.majority();
-        }
-    }
-
-    /**
-     * Gets a list of nodes for initial deployment. Always contains at least a 
majority of CMG nodes.
-     *
-     * @param nodes List of consistent IDs of nodes to add to the majority.
-     * @return Completed future with a set of consistent IDs, or a future, 
completed exceptionally with
-     *         {@link InvalidNodesArgumentException} if any of the nodes are 
not present in the logical topology.
-     */
-    private CompletableFuture<Set<String>> extractNodes(List<String> nodes) {
-        return cmgManager.majority()
-                .thenCompose(majority -> cmgManager.logicalTopology()
-                        .thenApply(snapshot -> snapshot.nodes().stream()
-                                .map(ClusterNode::name)
-                                .collect(Collectors.toUnmodifiableSet()))
-                        .thenApply(allNodes -> {
-                            Set<String> result = new HashSet<>(majority);
-                            for (String node : nodes) {
-                                if (!allNodes.contains(node)) {
-                                    throw new InvalidNodesArgumentException(
-                                            "Node \"" + node + "\" is not 
present in the logical topology"
-                                    );
-                                }
-                                result.add(node);
-                            }
-                            return result;
-                        })
-                );
-    }
 }
diff --git 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/IgniteDeployment.java
 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/IgniteDeployment.java
index 7ed34b21c6..2f3a7782d9 100644
--- 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/IgniteDeployment.java
+++ 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/IgniteDeployment.java
@@ -33,16 +33,16 @@ public interface IgniteDeployment extends IgniteComponent {
      * @param id Unit identifier. Not empty and not null.
      * @param version Unit version.
      * @param deploymentUnit Unit content.
-     * @param deployMode Initial deploy mode.
+     * @param nodesToDeploy Nodes for initial deploy.
      * @return Future with success or not result.
      */
     default CompletableFuture<Boolean> deployAsync(
             String id,
             Version version,
-            DeploymentUnit deploymentUnit,
-            InitialDeployMode deployMode
+            CompletableFuture<DeploymentUnit> deploymentUnit,
+            NodesToDeploy nodesToDeploy
     ) {
-        return deployAsync(id, version, false, deploymentUnit, deployMode);
+        return deployAsync(id, version, false, deploymentUnit, nodesToDeploy);
     }
 
     /**
@@ -53,53 +53,15 @@ public interface IgniteDeployment extends IgniteComponent {
      * @param version Unit version.
      * @param force Force redeploy if unit with provided id and version exists.
      * @param deploymentUnit Unit content.
-     * @param deployMode Initial deploy mode.
+     * @param nodesToDeploy Nodes for initial deploy.
      * @return Future with success or not result.
      */
     CompletableFuture<Boolean> deployAsync(
             String id,
             Version version,
             boolean force,
-            DeploymentUnit deploymentUnit,
-            InitialDeployMode deployMode
-    );
-
-    /**
-     * Deploys provided unit to the current node. After the deploy is 
finished, the unit will be placed to the CMG group and to the nodes
-     * passed in the @{code initialNodes} list asynchronously.
-     *
-     * @param id Unit identifier. Not empty and not null.
-     * @param version Unit version.
-     * @param deploymentUnit Unit content.
-     * @param nodes List of nodes to deploy to initially.
-     * @return Future with success or not result.
-     */
-    default CompletableFuture<Boolean> deployAsync(
-            String id,
-            Version version,
-            DeploymentUnit deploymentUnit,
-            List<String> nodes
-    ) {
-        return deployAsync(id, version, false, deploymentUnit, nodes);
-    }
-
-    /**
-     * Deploys provided unit to the current node. After the deploy is 
finished, the unit will be placed to the CMG group and to the nodes
-     * passed in the @{code initialNodes} list asynchronously.
-     *
-     * @param id Unit identifier. Not empty and not null.
-     * @param version Unit version.
-     * @param force Force redeploy if unit with provided id and version exists.
-     * @param deploymentUnit Unit content.
-     * @param nodes List of nodes to deploy to initially.
-     * @return Future with success or not result.
-     */
-    CompletableFuture<Boolean> deployAsync(
-            String id,
-            Version version,
-            boolean force,
-            DeploymentUnit deploymentUnit,
-            List<String> nodes
+            CompletableFuture<DeploymentUnit> deploymentUnit,
+            NodesToDeploy nodesToDeploy
     );
 
     /**
diff --git 
a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/NodesToDeploy.java
 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/NodesToDeploy.java
new file mode 100644
index 0000000000..03bc636d55
--- /dev/null
+++ 
b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/NodesToDeploy.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.deployunit;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import 
org.apache.ignite.internal.cluster.management.ClusterManagementGroupManager;
+import 
org.apache.ignite.internal.deployunit.exception.InvalidNodesArgumentException;
+import org.apache.ignite.network.ClusterNode;
+
+/**
+ * Nodes for initial deploy.
+ */
+public class NodesToDeploy {
+    /**
+     * Direct nodes list.
+     */
+    private final List<String> nodesList;
+
+    /**
+     * Deploy nodes mode.
+     */
+    private final InitialDeployMode deployMode;
+
+    public NodesToDeploy(List<String> nodesList) {
+        this(null, nodesList);
+    }
+
+    public NodesToDeploy(InitialDeployMode deployMode) {
+        this(deployMode, null);
+    }
+
+    private NodesToDeploy(InitialDeployMode deployMode, List<String> 
nodesList) {
+        this.deployMode = deployMode;
+        this.nodesList = nodesList;
+    }
+
+    /**
+     * Returns a list of nodes for initial deployment.
+     *
+     * @param cmgManager Cluster management group.
+     * @return Set of nodes for initial deployment.
+     */
+    public CompletableFuture<Set<String>> 
extractNodes(ClusterManagementGroupManager cmgManager) {
+        return nodesList != null ? extractNodesFromList(cmgManager) : 
extractNodesFromMode(cmgManager);
+    }
+
+    private CompletableFuture<Set<String>> 
extractNodesFromMode(ClusterManagementGroupManager cmgManager) {
+        switch (deployMode) {
+            case ALL:
+                return cmgManager.logicalTopology()
+                        .thenApply(snapshot -> snapshot.nodes().stream()
+                                .map(ClusterNode::name)
+                                .collect(Collectors.toUnmodifiableSet()));
+            case MAJORITY:
+            default:
+                return cmgManager.majority();
+        }
+    }
+
+    /**
+     * Gets a list of nodes for initial deployment. Always contains at least a 
majority of CMG nodes.
+     *
+     * @param cmgManager CMG manager.
+     * @return Completed future with a set of consistent IDs, or a future, 
completed exceptionally with
+     *         {@link InvalidNodesArgumentException} if any of the nodes are 
not present in the logical topology.
+     */
+    private CompletableFuture<Set<String>> 
extractNodesFromList(ClusterManagementGroupManager cmgManager) {
+        return cmgManager.majority()
+                .thenCompose(majority -> cmgManager.logicalTopology()
+                        .thenApply(snapshot -> snapshot.nodes().stream()
+                                .map(ClusterNode::name)
+                                .collect(Collectors.toUnmodifiableSet()))
+                        .thenApply(allNodes -> {
+                            Set<String> result = new HashSet<>(majority);
+                            for (String node : nodesList) {
+                                if (!allNodes.contains(node)) {
+                                    throw new InvalidNodesArgumentException(
+                                            "Node \"" + node + "\" is not 
present in the logical topology"
+                                    );
+                                }
+                                result.add(node);
+                            }
+                            return result;
+                        })
+                );
+    }
+
+    @Override
+    public String toString() {
+        return "NodesToDeploy{"
+                + "nodesList=" + nodesList
+                + ", deployMode=" + deployMode
+                + '}';
+    }
+}
diff --git 
a/modules/compute/src/test/java/org/apache/ignite/internal/compute/util/DummyIgniteDeployment.java
 
b/modules/compute/src/test/java/org/apache/ignite/internal/compute/util/DummyIgniteDeployment.java
index 75f6d173a0..408d3da8e4 100644
--- 
a/modules/compute/src/test/java/org/apache/ignite/internal/compute/util/DummyIgniteDeployment.java
+++ 
b/modules/compute/src/test/java/org/apache/ignite/internal/compute/util/DummyIgniteDeployment.java
@@ -31,7 +31,7 @@ import org.apache.ignite.compute.version.Version;
 import org.apache.ignite.internal.deployunit.DeploymentStatus;
 import org.apache.ignite.internal.deployunit.DeploymentUnit;
 import org.apache.ignite.internal.deployunit.IgniteDeployment;
-import org.apache.ignite.internal.deployunit.InitialDeployMode;
+import org.apache.ignite.internal.deployunit.NodesToDeploy;
 import org.apache.ignite.internal.deployunit.UnitStatuses;
 import 
org.apache.ignite.internal.deployunit.exception.DeploymentUnitNotFoundException;
 
@@ -46,17 +46,15 @@ public class DummyIgniteDeployment implements 
IgniteDeployment {
     }
 
     @Override
-    public CompletableFuture<Boolean> deployAsync(String id, Version version, 
boolean force, DeploymentUnit deploymentUnit,
-            InitialDeployMode deployMode) {
+    public CompletableFuture<Boolean> deployAsync(
+            String id,
+            Version version,
+            boolean force,
+            CompletableFuture<DeploymentUnit> deploymentUnit,
+            NodesToDeploy nodesToDeploy) {
         throw new UnsupportedOperationException("Not implemented");
     }
 
-    @Override
-    public CompletableFuture<Boolean> deployAsync(String id, Version version, 
boolean force, DeploymentUnit deploymentUnit,
-            List<String> nodes) {
-        return null;
-    }
-
     @Override
     public CompletableFuture<Boolean> undeployAsync(String id, Version 
version) {
         throw new UnsupportedOperationException("Not implemented");
diff --git 
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
 
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
index 428aa1fef9..6d8a946a7d 100644
--- 
a/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
+++ 
b/modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java
@@ -33,6 +33,7 @@ import java.util.stream.Collectors;
 import org.apache.ignite.compute.version.Version;
 import org.apache.ignite.internal.deployunit.DeploymentUnit;
 import org.apache.ignite.internal.deployunit.IgniteDeployment;
+import org.apache.ignite.internal.deployunit.NodesToDeploy;
 import org.apache.ignite.internal.deployunit.UnitStatuses;
 import org.apache.ignite.internal.rest.api.deployment.DeploymentCodeApi;
 import org.apache.ignite.internal.rest.api.deployment.DeploymentStatus;
@@ -63,13 +64,9 @@ public class DeploymentManagementController implements 
DeploymentCodeApi {
     ) {
         CompletableFuture<DeploymentUnit> result = new CompletableFuture<>();
         unitContent.subscribe(new CompletedFileUploadSubscriber(result));
-        return result.thenCompose(deploymentUnit -> {
-            if (initialNodes.isPresent()) {
-                return deployment.deployAsync(unitId, 
Version.parseVersion(unitVersion), deploymentUnit, initialNodes.get());
-            } else {
-                return deployment.deployAsync(unitId, 
Version.parseVersion(unitVersion), deploymentUnit, 
fromInitialDeployMode(deployMode));
-            }
-        });
+        NodesToDeploy nodesToDeploy = initialNodes.map(NodesToDeploy::new)
+                .orElseGet(() -> new 
NodesToDeploy(fromInitialDeployMode(deployMode)));
+        return deployment.deployAsync(unitId, 
Version.parseVersion(unitVersion), result, nodesToDeploy);
     }
 
     @Override
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestStandalone.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestStandalone.java
index c10ef85b85..4089cc0768 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestStandalone.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/compute/ItComputeTestStandalone.java
@@ -33,6 +33,7 @@ import java.util.concurrent.CompletableFuture;
 import org.apache.ignite.compute.DeploymentUnit;
 import org.apache.ignite.compute.version.Version;
 import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.deployunit.NodesToDeploy;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
@@ -133,8 +134,8 @@ class ItComputeTestStandalone extends ItComputeBaseTest {
             CompletableFuture<Boolean> deployed = 
node.deployment().deployAsync(
                     unitId,
                     unitVersion,
-                    () -> Map.of(jarName, jarStream),
-                    MAJORITY
+                    CompletableFuture.completedFuture(() -> Map.of(jarName, 
jarStream)),
+                    new NodesToDeploy(MAJORITY)
             );
 
             assertThat(deployed, willBe(true));
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/DeployFiles.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/DeployFiles.java
index 782249c2a7..11bd2d03d0 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/DeployFiles.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/DeployFiles.java
@@ -35,10 +35,9 @@ import java.util.stream.Collectors;
 import org.apache.ignite.compute.version.Version;
 import org.apache.ignite.internal.app.IgniteImpl;
 import org.apache.ignite.internal.deployunit.DeploymentUnit;
-import org.apache.ignite.internal.deployunit.InitialDeployMode;
+import org.apache.ignite.internal.deployunit.NodesToDeploy;
 import org.apache.ignite.internal.deployunit.UnitStatuses;
 import org.apache.ignite.internal.deployunit.UnitStatuses.UnitStatusesBuilder;
-import org.jetbrains.annotations.Nullable;
 
 class DeployFiles {
     private static final int BASE_REPLICA_TIMEOUT = 30;
@@ -100,7 +99,7 @@ class DeployFiles {
     }
 
     public Unit deployAndVerify(String id, Version version, boolean force, 
List<DeployFile> files, IgniteImpl entryNode) {
-        return deployAndVerify(id, version, force, files, null, List.of(), 
entryNode);
+        return deployAndVerify(id, version, force, files, new 
NodesToDeploy(List.of()), entryNode);
     }
 
     public Unit deployAndVerify(
@@ -108,8 +107,7 @@ class DeployFiles {
             Version version,
             boolean force,
             List<DeployFile> files,
-            @Nullable InitialDeployMode deployMode,
-            List<String> initialNodes,
+            NodesToDeploy nodesToDeploy,
             IgniteImpl entryNode
     ) {
         List<Path> paths = files.stream()
@@ -117,13 +115,9 @@ class DeployFiles {
                 .collect(Collectors.toList());
 
         CompletableFuture<Boolean> deploy;
-        if (deployMode != null) {
-            deploy = entryNode.deployment()
-                    .deployAsync(id, version, force, fromPaths(paths), 
deployMode);
-        } else {
-            deploy = entryNode.deployment()
-                    .deployAsync(id, version, force, fromPaths(paths), 
initialNodes);
-        }
+
+        deploy = entryNode.deployment()
+                .deployAsync(id, version, force, fromPaths(paths), 
nodesToDeploy);
 
         assertThat(deploy, willBe(true));
 
@@ -160,7 +154,7 @@ class DeployFiles {
         return builder.build();
     }
 
-    private static DeploymentUnit fromPaths(List<Path> paths) {
+    private static CompletableFuture<DeploymentUnit> fromPaths(List<Path> 
paths) {
         Objects.requireNonNull(paths);
         Map<String, InputStream> map = new HashMap<>();
         try {
@@ -170,6 +164,6 @@ class DeployFiles {
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
-        return () -> map;
+        return CompletableFuture.completedFuture(() -> map);
     }
 }
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/ItDeploymentUnitFailoverTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/ItDeploymentUnitFailoverTest.java
index fbe3ff5c93..4729e4989a 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/ItDeploymentUnitFailoverTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/ItDeploymentUnitFailoverTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.compute.version.Version;
 import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
 import org.apache.ignite.internal.app.IgniteImpl;
 import org.apache.ignite.internal.deployunit.IgniteDeployment;
+import org.apache.ignite.internal.deployunit.NodesToDeploy;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -54,8 +55,7 @@ public class ItDeploymentUnitFailoverTest extends 
ClusterPerTestIntegrationTest
                 Version.parseVersion("1.0.0"),
                 false,
                 List.of(files.bigFile()),
-                null,
-                List.of(node.name()),
+                new NodesToDeploy(List.of(node.name())),
                 cmgNode
         );
 
@@ -74,9 +74,11 @@ public class ItDeploymentUnitFailoverTest extends 
ClusterPerTestIntegrationTest
         String id = "id1";
         Version version = Version.parseVersion("1.0.0");
         Unit unit = files.deployAndVerify(
-                id, version, false,
+                id,
+                version,
+                false,
                 List.of(files.smallFile()),
-                null, List.of(node(nodeIndex).name()),
+                new NodesToDeploy(List.of(node(nodeIndex).name())),
                 node(0)
         );
 
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/ItDeploymentUnitTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/ItDeploymentUnitTest.java
index ceb026d673..1686edf651 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/ItDeploymentUnitTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/ItDeploymentUnitTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.app.IgniteImpl;
 import org.apache.ignite.internal.deployunit.DeploymentStatus;
 import org.apache.ignite.internal.deployunit.IgniteDeployment;
 import org.apache.ignite.internal.deployunit.InitialDeployMode;
+import org.apache.ignite.internal.deployunit.NodesToDeploy;
 import org.apache.ignite.internal.deployunit.UnitStatuses;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
@@ -230,7 +231,7 @@ public class ItDeploymentUnitTest extends 
ClusterPerTestIntegrationTest {
         String id = "test";
         Unit smallUnit = files.deployAndVerify(
                 id, Version.parseVersion("1.1.0"), false, 
List.of(files.smallFile()),
-                null, List.of(node(1).name()),
+                new NodesToDeploy(List.of(node(1).name())),
                 node(0)
         );
 
@@ -244,7 +245,7 @@ public class ItDeploymentUnitTest extends 
ClusterPerTestIntegrationTest {
         String id = "test";
         Unit smallUnit = files.deployAndVerify(
                 id, Version.parseVersion("1.1.0"), false, 
List.of(files.smallFile()),
-                InitialDeployMode.ALL, List.of(),
+                new NodesToDeploy(InitialDeployMode.ALL),
                 node(0)
         );
 

Reply via email to