J-Bakuli commented on code in PR #10328:
URL: https://github.com/apache/ignite/pull/10328#discussion_r1040712197


##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -704,6 +704,77 @@ public void testClusterChangeTag() throws Exception {
         assertTrue("Tag has not been updated in 10 seconds", tagUpdated);
     }
 
+    /**
+     * Tests idle_verify working on an active cluster with persistence. Works 
via control.sh.
+     *
+     * @throws Exception if failed.
+     */
+    @Test
+    public void testIdleVerifyOnActiveClusterWithPersistence() throws 
Exception {
+        dataRegionConfiguration = new DataRegionConfiguration()
+                .setName("persistent-dataRegion")
+                .setPersistenceEnabled(true);
+
+        Ignite ignite = startGrids(1);
+
+        ignite.cluster().state(ACTIVE);
+
+        assertTrue(ignite.cluster().active());
+        assertEquals(ACTIVE, ignite.cluster().state());
+
+        ignite.createCache(new CacheConfiguration<>("persistent-cache")
+                .setDataRegionName("persistent-dataRegion"));
+
+        injectTestSystemOut();
+
+        assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify"));
+
+        assertTrue(ignite.cluster().active());
+        assertEquals(ACTIVE, ignite.cluster().state());
+        assertContains(log, testOut.toString(), "The check procedure has 
finished, no conflicts have been found.");
+    }
+
+    /**
+     * Tests idle_verify working on an inactive cluster with persistence. 
Works via control.sh.
+     *
+     * @throws IgniteException if succeeded.
+     */
+    @Test
+    public void testIdleVerifyOnInactiveClusterWithPersistence() throws 
Exception {
+        dataRegionConfiguration = new DataRegionConfiguration()
+                .setName("persistent-dataRegion")
+                .setPersistenceEnabled(true);
+
+        Ignite ignite = startGrids(2);
+
+        ignite.cluster().state(INACTIVE);
+
+        assertFalse(ignite.cluster().active());
+        assertEquals(INACTIVE, ignite.cluster().state());
+
+        injectTestSystemOut();
+
+        GridTestUtils.assertThrows(
+                log,
+                () -> ignite.createCache(new 
CacheConfiguration<>("persistent-cache")
+                        .setDataRegionName("persistent-dataRegion")),
+                IgniteException.class,
+                "Can not perform the operation because the cluster is 
inactive. " +
+                        "Note, that the cluster is considered inactive by 
default if Ignite Persistent Store is used to " +
+                        "let all the nodes join the cluster. To activate the 
cluster call Ignite.active(true).");
+
+        execute("--cache", "idle_verify");
+
+        assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify"));
+
+        String out = testOut.toString();
+
+        assertContains(log, out, "idle_verify does not work on an inactive 
cluster with persistence");
+        assertFalse(ignite.cluster().active());

Review Comment:
   I propose to leave assertContains(), as it checks the thrown content as per 
the current code logic.
   
   Agree re assertFalse().
   
   Thank you



-- 
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