Skip to content
Permalink
Browse files
IGNITE-17035 Fixed flaky testChangeSnapshotTransferRateInRuntime test. (
  • Loading branch information
NSAmelchev committed May 26, 2022
1 parent 189fc96 commit c08b153d6f130984b463a5a3190d8530497d25b1
Showing 1 changed file with 10 additions and 1 deletion.
@@ -105,6 +105,7 @@
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 void testChangeSnapshotTransferRateInRuntime() throws Exception {
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 void testChangeSnapshotTransferRateInRuntime() throws Exception {
// 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);
}

0 comments on commit c08b153

Please sign in to comment.