You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by na...@apache.org on 2022/05/26 12:15:49 UTC

[ignite] branch master updated: IGNITE-17035 Fixed flaky testChangeSnapshotTransferRateInRuntime test. (#10041)

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

namelchev 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 c08b153d6f1 IGNITE-17035 Fixed flaky testChangeSnapshotTransferRateInRuntime test. (#10041)
c08b153d6f1 is described below

commit c08b153d6f130984b463a5a3190d8530497d25b1
Author: Nikita Amelchev <ns...@gmail.com>
AuthorDate: Thu May 26 15:15:42 2022 +0300

    IGNITE-17035 Fixed flaky testChangeSnapshotTransferRateInRuntime test. (#10041)
---
 .../java/org/apache/ignite/util/GridCommandHandlerTest.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java b/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
index 2e6d93ab94e..1e01c88587e 100644
--- a/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
+++ b/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
@@ -105,6 +105,7 @@ import org.apache.ignite.internal.processors.cache.warmup.BlockedWarmUpStrategy;
 import org.apache.ignite.internal.processors.cache.warmup.WarmUpTestPluginProvider;
 import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
 import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
+import org.apache.ignite.internal.util.BasicRateLimiter;
 import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.lang.GridFunc;
@@ -3020,8 +3021,10 @@ public class GridCommandHandlerTest extends GridCommandHandlerClusterPerMethodAb
         Function<Integer, Integer> propFunc =
             (num) -> execute("--property", "set", "--name", SNAPSHOT_TRANSFER_RATE_DMS_KEY, "--val", String.valueOf(num));
 
+        int rate = SNAPSHOT_LIMITED_TRANSFER_BLOCK_SIZE_BYTES;
+
         // Limit the transfer rate.
-        assertEquals(EXIT_CODE_OK, (int)propFunc.apply(SNAPSHOT_LIMITED_TRANSFER_BLOCK_SIZE_BYTES));
+        assertEquals(EXIT_CODE_OK, (int)propFunc.apply(rate));
 
         IgniteFuture<Void> snpFut = ignite.snapshot().createSnapshot("snapshot2");
 
@@ -3032,6 +3035,12 @@ public class GridCommandHandlerTest extends GridCommandHandlerClusterPerMethodAb
         // Set transfer rate to unlimited.
         assertEquals(EXIT_CODE_OK, (int)propFunc.apply(0));
 
+        // Add release time of BasicRateLimiter#acquire() for the given rate.
+        BasicRateLimiter limiter = new BasicRateLimiter(rate);
+
+        limiter.acquire(SNAPSHOT_LIMITED_TRANSFER_BLOCK_SIZE_BYTES);
+        limiter.acquire(SNAPSHOT_LIMITED_TRANSFER_BLOCK_SIZE_BYTES);
+
         snpFut.get(maxOpTime);
     }