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

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


The following commit(s) were added to refs/heads/ignite-16771 by this push:
     new 50256a740 
testClientSendsComputeJobToDefaultNodeWhenDirectConnectionToTargetDoesNotExist
50256a740 is described below

commit 50256a740b341ae193b3af7fba2682da618e0786
Author: Pavel Tupitsyn <ptupit...@apache.org>
AuthorDate: Thu Apr 14 19:51:53 2022 +0300

    
testClientSendsComputeJobToDefaultNodeWhenDirectConnectionToTargetDoesNotExist
---
 .../org/apache/ignite/client/ClientComputeTest.java  | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git 
a/modules/client/src/test/java/org/apache/ignite/client/ClientComputeTest.java 
b/modules/client/src/test/java/org/apache/ignite/client/ClientComputeTest.java
index 4234205f1..79eb91af2 100644
--- 
a/modules/client/src/test/java/org/apache/ignite/client/ClientComputeTest.java
+++ 
b/modules/client/src/test/java/org/apache/ignite/client/ClientComputeTest.java
@@ -48,7 +48,7 @@ public class ClientComputeTest {
     public void 
testClientSendsComputeJobToTargetNodeWhenDirectConnectionExists() throws 
Exception {
         initServers(reqId -> false);
 
-        try (var client = getClient()) {
+        try (var client = getClient(server1, server2, server3)) {
             IgniteTestUtils.waitForCondition(() -> client.connections().size() 
== 3, 3000);
 
             String res1 = 
client.compute().<String>execute(getClusterNodes("s1"), "job").join();
@@ -62,8 +62,18 @@ public class ClientComputeTest {
     }
 
     @Test
-    public void 
testClientSendsComputeJobToDefaultNodeWhenDirectConnectionToTargetDoesNotExist()
 {
+    public void 
testClientSendsComputeJobToDefaultNodeWhenDirectConnectionToTargetDoesNotExist()
 throws Exception {
+        initServers(reqId -> false);
+
+        try (var client = getClient(server3)) {
+            String res1 = 
client.compute().<String>execute(getClusterNodes("s1"), "job").join();
+            String res2 = 
client.compute().<String>execute(getClusterNodes("s2"), "job").join();
+            String res3 = 
client.compute().<String>execute(getClusterNodes("s3"), "job").join();
 
+            assertEquals("s3", res1);
+            assertEquals("s3", res2);
+            assertEquals("s3", res3);
+        }
     }
 
     @Test
@@ -71,9 +81,11 @@ public class ClientComputeTest {
 
     }
 
-    private IgniteClient getClient() {
+    private IgniteClient getClient(TestServer... servers) {
+        String[] addresses = Arrays.stream(servers).map(s -> "127.0.0.1:" + 
s.port()).toArray(String[]::new);
+
         return IgniteClient.builder()
-                .addresses("127.0.0.1:" + server1.port(), "127.0.0.1:" + 
server2.port(), "127.0.0.1:" + server3.port())
+                .addresses(addresses)
                 .reconnectThrottlingPeriod(0)
                 .build();
     }

Reply via email to