Skip to content

Commit

Permalink
Polishing #1140
Browse files Browse the repository at this point in the history
Increase test loop count for race condition detection. Fix ScanIteratorIntegrationTests.
  • Loading branch information
mp911de committed Oct 25, 2019
1 parent b54bd5b commit 61d3141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import io.lettuce.core.codec.StringCodec;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
import io.lettuce.core.*;
Expand All @@ -41,7 +40,7 @@
import io.lettuce.core.cluster.api.sync.RedisAdvancedClusterCommands;
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
import io.lettuce.core.cluster.models.partitions.RedisClusterNode;
import io.lettuce.core.codec.Utf8StringCodec;
import io.lettuce.core.codec.StringCodec;
import io.lettuce.test.*;
import io.lettuce.test.condition.EnabledOnCommand;
import io.netty.util.internal.ConcurrentSet;
Expand Down Expand Up @@ -249,7 +248,7 @@ void keysDoesNotRunIntoRaceConditions() {

Futures.awaitAll(futures);

for (int i = 0; i < 100; i++) {
for (int i = 0; i < 1000; i++) {
CompletableFuture<Long> future = commands.keys("*").count().toFuture();
Futures.await(future);
}
Expand Down Expand Up @@ -314,8 +313,7 @@ void readFromReplicas() {
connection.readOnly().subscribe();
commands.set(key, value).subscribe();

NodeSelectionAsyncIntegrationTests
.waitForReplication(commands.getStatefulConnection().async(), ClusterTestSettings.key,
NodeSelectionAsyncIntegrationTests.waitForReplication(commands.getStatefulConnection().async(), ClusterTestSettings.key,
ClusterTestSettings.port4);

AtomicBoolean error = new AtomicBoolean();
Expand Down Expand Up @@ -415,8 +413,8 @@ void clusterScanStreamingWithArgs() {
}
} while (!scanCursor.isFinished());

assertThat(adapter.getList()).containsAll(
KeysAndValues.KEYS.stream().filter(k -> k.startsWith("a")).collect(Collectors.toList()));
assertThat(adapter.getList())
.containsAll(KeysAndValues.KEYS.stream().filter(k -> k.startsWith("a")).collect(Collectors.toList()));
}

private void writeKeysToTwoNodes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ class ScanIteratorIntegrationTests extends TestSupport {
@Inject
ScanIteratorIntegrationTests(StatefulRedisClusterConnection<String, String> connection) {
this.connection = connection;
this.connection.setReadFrom(ReadFrom.MASTER);
this.redis = connection.sync();
this.connection.sync().flushall();
}

@BeforeEach
void setUp() {
this.redis.flushall();
this.connection.setReadFrom(ReadFrom.MASTER);
}

@Test
Expand Down Expand Up @@ -184,7 +185,6 @@ void sscanShouldThrowNoSuchElementExceptionOnEmpty() {

@Test
void setSinglePass() {

redis.sadd(key, KeysAndValues.KEYS.toArray(new String[0]));

ScanIterator<String> scan = ScanIterator.sscan(redis, key, ScanArgs.Builder.limit(50).match("key-11*"));
Expand Down

0 comments on commit 61d3141

Please sign in to comment.