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

dspavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 8eff8da1ab9 IGNITE-28684: MDC test fix with first nodes with 
predictable assingnment (#13143)
8eff8da1ab9 is described below

commit 8eff8da1ab9cca2e36360bdd47110767130a1d59
Author: ignitetcbot <[email protected]>
AuthorDate: Tue May 19 18:03:11 2026 +0300

    IGNITE-28684: MDC test fix with first nodes with predictable assingnment 
(#13143)
    
    Codex co-authored-by: Dmitriy Pavlov <[email protected]>
---
 .../spi/discovery/tcp/MultiDataCenterRingTest.java | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/MultiDataCenterRingTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/MultiDataCenterRingTest.java
index bdec5e5e718..67e4b87cc46 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/MultiDataCenterRingTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/MultiDataCenterRingTest.java
@@ -56,7 +56,7 @@ public class MultiDataCenterRingTest extends 
GridCommonAbstractTest {
     public void testRing() throws Exception {
         int cnt = 10;
 
-        generateRandomDcOrderCluster(cnt);
+        generateRandomDcOrderCluster(cnt, 1, 2);
 
         assertEquals(cnt, grid(0).cluster().nodes().size());
 
@@ -115,10 +115,28 @@ public class MultiDataCenterRingTest extends 
GridCommonAbstractTest {
 
     /** */
     private void generateRandomDcOrderCluster(int cnt) throws Exception {
+        generateRandomDcOrderCluster(cnt, -1, -1);
+    }
+
+    /**
+     * @param cnt Nodes count.
+     * @param dc0NodeIdx Node index that should be assigned to {@link 
#DC_ID_0}, or {@code -1} if not required.
+     * @param dc1NodeIdx Node index that should be assigned to {@link 
#DC_ID_1}, or {@code -1} if not required.
+     */
+    private void generateRandomDcOrderCluster(int cnt, int dc0NodeIdx, int 
dc1NodeIdx) throws Exception {
         ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
         for (int i = 0; i < cnt; i++) {
-            System.setProperty(IgniteSystemProperties.IGNITE_DATA_CENTER_ID, 
rnd.nextBoolean() ? DC_ID_0 : DC_ID_1);
+            String dcId;
+
+            if (i == dc0NodeIdx)
+                dcId = DC_ID_0;
+            else if (i == dc1NodeIdx)
+                dcId = DC_ID_1;
+            else
+                dcId = rnd.nextBoolean() ? DC_ID_0 : DC_ID_1;
+
+            System.setProperty(IgniteSystemProperties.IGNITE_DATA_CENTER_ID, 
dcId);
 
             startGrid(i);
         }

Reply via email to