sashapolo commented on code in PR #1807:
URL: https://github.com/apache/ignite-3/pull/1807#discussion_r1144441506


##########
modules/core/src/test/java/org/apache/ignite/internal/causality/IncrementalVersionedValueTest.java:
##########
@@ -308,33 +298,20 @@ void testConcurrentGetAndCompleteWithHistoryTrimming() 
throws Exception {
         // Set history size to 2.
         versionedValue.complete(3);
 
-        var barrier = new CyclicBarrier(2);
+        runRace(
+                () -> {
+                    versionedValue.update(4, (i, t) -> completedFuture(i + 1));
+                    // Trigger history trimming
+                    versionedValue.complete(4);
+                },
+                () -> {
+                    CompletableFuture<Integer> readerFuture = 
versionedValue.get(2);
 
-        CompletableFuture<Void> writerFuture = CompletableFuture.runAsync(() 
-> {
-            try {
-                barrier.await(1, TimeUnit.SECONDS);
-
-                versionedValue.update(4, (i, t) -> completedFuture(i + 1));
-                // Trigger history trimming
-                versionedValue.complete(4);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        });
-
-        barrier.await(1, TimeUnit.SECONDS);
-
-        try {
-            CompletableFuture<Integer> readerFuture = versionedValue.get(2);
-
-            assertThat(readerFuture, willBe(1));
-        } catch (OutdatedTokenException ignored) {
-            // This is considered as a valid outcome.
-        }
+                    assertThat(readerFuture, willBe(1));

Review Comment:
   Because I messed up, this test already failed and I've fixed it



##########
modules/core/src/test/java/org/apache/ignite/internal/causality/IncrementalVersionedValueTest.java:
##########
@@ -308,33 +298,20 @@ void testConcurrentGetAndCompleteWithHistoryTrimming() 
throws Exception {
         // Set history size to 2.
         versionedValue.complete(3);
 
-        var barrier = new CyclicBarrier(2);
+        runRace(
+                () -> {
+                    versionedValue.update(4, (i, t) -> completedFuture(i + 1));
+                    // Trigger history trimming
+                    versionedValue.complete(4);
+                },
+                () -> {
+                    CompletableFuture<Integer> readerFuture = 
versionedValue.get(2);
 
-        CompletableFuture<Void> writerFuture = CompletableFuture.runAsync(() 
-> {
-            try {
-                barrier.await(1, TimeUnit.SECONDS);
-
-                versionedValue.update(4, (i, t) -> completedFuture(i + 1));
-                // Trigger history trimming
-                versionedValue.complete(4);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        });
-
-        barrier.await(1, TimeUnit.SECONDS);
-
-        try {
-            CompletableFuture<Integer> readerFuture = versionedValue.get(2);
-
-            assertThat(readerFuture, willBe(1));
-        } catch (OutdatedTokenException ignored) {
-            // This is considered as a valid outcome.
-        }
+                    assertThat(readerFuture, willBe(1));

Review Comment:
   Because I messed up, this test has already failed because of it and I've 
fixed it



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