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


##########
modules/metastorage/src/integrationTest/java/org/apache/ignite/internal/metastorage/impl/ItIdempotentCommandCacheTest.java:
##########
@@ -329,23 +339,63 @@ boolean checkValueInStorage(byte[] testKey, byte[] 
testValueExpected) {
 
     @BeforeEach
     void setUp(TestInfo testInfo) {
-        startCluster(testInfo);
+        this.testInfo = testInfo;
+
+        if 
(testInfo.getTestMethod().orElseThrow().isAnnotationPresent(DisableIdleSafeTimePropagation.class))
 {
+            assertThat(
+                    
systemDistributedConfiguration.idleSafeTimeSyncIntervalMillis().update(HOURS.toMillis(1)),
+                    willCompleteSuccessfully()
+            );
+        }
+
+        startCluster();
     }
 
     @AfterEach
     void tearDown() throws Exception {
-        closeAll(nodes.stream());
+        closeAllManually(nodes.stream());
     }
 
-    @Test
-    public void testIdempotentInvoke() throws InterruptedException {
+    @ParameterizedTest
+    @EnumSource(Invoker.class)
+    void testIdempotentInvoke(Invoker invoker) {
+        Node leader = leader(raftClient());
+
+        boolean result = doRetriedInvoke(invoker, leader);
+
+        assertTrue(result);
+        assertTrue(leader.checkValueInStorage(TEST_KEY.bytes(), TEST_VALUE));
+    }
+
+    private boolean doRetriedInvoke(Invoker invoker, Node leader) {
         AtomicInteger writeActionReqCount = new AtomicInteger();
         CompletableFuture<Void> retryBlockingFuture = new 
CompletableFuture<>();
 
         log.info("Test: blocking messages.");
 
-        Node leader = leader(raftClient());
+        dropResponseToFirstInvoke(leader, writeActionReqCount, 
retryBlockingFuture);
+
+        MetaStorageManager metaStorageManager = leader.metaStorageManager;
+
+        CompletableFuture<Boolean> fut = invoker.invokeOn(metaStorageManager);
+
+        await().until(() -> leader.checkValueInStorage(TEST_KEY.bytes(), 
TEST_VALUE));
+
+        log.info("Test: value appeared in storage.");
+
+        assertTrue(retryBlockingFuture.complete(null));

Review Comment:
   I just refactored this code, but I suppose that it's because `complete()` 
will return `false` if it's already completed (in this case, by an exception), 
and it makes sense to check for it, I guess



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