rpuch commented on code in PR #795:
URL: https://github.com/apache/ignite-3/pull/795#discussion_r879548234


##########
modules/cluster-management/src/integrationTest/java/org/apache/ignite/internal/cluster/management/raft/ItCmgRaftServiceTest.java:
##########
@@ -240,18 +270,128 @@ void testClusterState() {
         assertThat(node1.raftService.readClusterState(), 
willCompleteSuccessfully());
         assertThat(node2.raftService.readClusterState(), 
willCompleteSuccessfully());
 
-        ClusterState state = new ClusterState(List.of("foo"), List.of("bar"));
+        ClusterState state = new ClusterState(
+                List.of("foo"),
+                List.of("bar"),
+                IgniteProductVersion.CURRENT_VERSION,
+                new ClusterTag("cluster")
+        );
 
         assertThat(node1.raftService.writeClusterState(state), 
willCompleteSuccessfully());
 
         assertThat(node1.raftService.readClusterState(), willBe(state));
         assertThat(node2.raftService.readClusterState(), willBe(state));
 
-        state = new ClusterState(List.of("baz"), List.of("quux"));
+        state = new ClusterState(
+                List.of("baz"),
+                List.of("quux"),
+                IgniteProductVersion.fromString("3.3.3"),
+                new ClusterTag("new cluster")
+        );
 
         assertThat(node2.raftService.writeClusterState(state), 
willCompleteSuccessfully());
 
         assertThat(node1.raftService.readClusterState(), willBe(state));
         assertThat(node2.raftService.readClusterState(), willBe(state));
     }
+
+    /**
+     * Test validation of the Cluster Tag.
+     */
+    @Test
+    void testClusterTagValidation() {
+        Node node1 = cluster.get(0);
+        Node node2 = cluster.get(1);
+
+        ClusterState state = new ClusterState(
+                List.of("foo"),
+                List.of("bar"),
+                IgniteProductVersion.CURRENT_VERSION,
+                new ClusterTag("cluster")
+        );
+
+        assertThat(node1.raftService.writeClusterState(state), 
willCompleteSuccessfully());
+
+        // empty tag
+        assertThat(node2.raftService.startJoinCluster(null), 
willCompleteSuccessfully());
+
+        // correct tag
+        assertThat(node2.raftService.startJoinCluster(state.clusterTag()), 
willCompleteSuccessfully());
+
+        // incorrect tag
+        assertThrowsWithCause(
+                () -> node2.raftService.startJoinCluster(new 
ClusterTag("invalid")).get(10, TimeUnit.SECONDS),
+                IgniteInternalException.class,
+                "Join request denied, reason: Cluster tags do not match"
+        );
+    }
+
+    /**
+     * Test validation of Ignite Product Version upon join.
+     */
+    @Test
+    void testIgniteVersionValidation() {
+        CmgRaftService raftService = cluster.get(0).raftService;
+
+        ClusterState state = new ClusterState(
+                List.of("foo"),
+                List.of("bar"),
+                IgniteProductVersion.fromString("1.2.3"),

Review Comment:
   I see, ok



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to