From 8e2084cae94147fccc31867a015fd011d1bf5081 Mon Sep 17 00:00:00 2001 From: jruaux Date: Mon, 29 Apr 2024 16:18:39 -0700 Subject: [PATCH] test: Moved replicate-key-exclude test to stack --- ...rpriseContainerStackReplicationTests.java} | 2 +- ...nterpriseServerStackReplicationTests.java} | 2 +- .../com/redis/riot/cli/PostgresTests.java | 2 +- ...cationTests.java => ReplicationTests.java} | 37 ++++++------------- ...{AbstractDbTests.java => RiotDbTests.java} | 2 +- ...kEnterpriseContainerReplicationTests.java} | 2 +- ...tackEnterpriseServerReplicationTests.java} | 2 +- .../cli/StackToStackReplicationTests.java | 20 ---------- ...ationTests.java => StackToStackTests.java} | 23 ++++++++++-- 9 files changed, 36 insertions(+), 56 deletions(-) rename plugins/riot/src/test/java/com/redis/riot/cli/{EnterpriseContainerToStackTests.java => EnterpriseContainerStackReplicationTests.java} (89%) rename plugins/riot/src/test/java/com/redis/riot/cli/{EnterpriseServerToStackTests.java => EnterpriseServerStackReplicationTests.java} (90%) rename plugins/riot/src/test/java/com/redis/riot/cli/{AbstractReplicationTests.java => ReplicationTests.java} (79%) rename plugins/riot/src/test/java/com/redis/riot/cli/{AbstractDbTests.java => RiotDbTests.java} (97%) rename plugins/riot/src/test/java/com/redis/riot/cli/{StackToEnterpriseContainerReplicationTests.java => StackEnterpriseContainerReplicationTests.java} (87%) rename plugins/riot/src/test/java/com/redis/riot/cli/{StackToEnterpriseServerReplicationTests.java => StackEnterpriseServerReplicationTests.java} (88%) delete mode 100644 plugins/riot/src/test/java/com/redis/riot/cli/StackToStackReplicationTests.java rename plugins/riot/src/test/java/com/redis/riot/cli/{StackToStackIntegrationTests.java => StackToStackTests.java} (96%) diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseContainerToStackTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseContainerStackReplicationTests.java similarity index 89% rename from plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseContainerToStackTests.java rename to plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseContainerStackReplicationTests.java index 337c57835..f031c4f6b 100644 --- a/plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseContainerToStackTests.java +++ b/plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseContainerStackReplicationTests.java @@ -7,7 +7,7 @@ import com.redis.testcontainers.RedisStackContainer; @EnabledOnOs(OS.LINUX) -class EnterpriseContainerToStackTests extends AbstractReplicationTests { +class EnterpriseContainerStackReplicationTests extends ReplicationTests { private static final RedisEnterpriseContainer source = RedisContainerFactory.enterprise(); private static final RedisStackContainer target = RedisContainerFactory.stack(); diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseServerToStackTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseServerStackReplicationTests.java similarity index 90% rename from plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseServerToStackTests.java rename to plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseServerStackReplicationTests.java index 82918a30a..6eb0d4bb3 100644 --- a/plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseServerToStackTests.java +++ b/plugins/riot/src/test/java/com/redis/riot/cli/EnterpriseServerStackReplicationTests.java @@ -6,7 +6,7 @@ import com.redis.testcontainers.RedisStackContainer; @EnabledIfEnvironmentVariable(named = RedisEnterpriseServer.ENV_HOST, matches = ".*") -class EnterpriseServerToStackTests extends AbstractReplicationTests { +class EnterpriseServerStackReplicationTests extends ReplicationTests { private static final RedisEnterpriseServer source = RedisContainerFactory.enterpriseServer(); private static final RedisStackContainer target = RedisContainerFactory.stack(); diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/PostgresTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/PostgresTests.java index 2e3ff3f4d..21af1aae3 100644 --- a/plugins/riot/src/test/java/com/redis/riot/cli/PostgresTests.java +++ b/plugins/riot/src/test/java/com/redis/riot/cli/PostgresTests.java @@ -23,7 +23,7 @@ import com.redis.spring.batch.gen.GeneratorItemReader; import com.redis.spring.batch.gen.Item.Type; -class PostgresTests extends AbstractDbTests { +class PostgresTests extends RiotDbTests { private static final DockerImageName postgresImage = DockerImageName.parse(PostgreSQLContainer.IMAGE) .withTag(PostgreSQLContainer.DEFAULT_TAG); diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/AbstractReplicationTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/ReplicationTests.java similarity index 79% rename from plugins/riot/src/test/java/com/redis/riot/cli/AbstractReplicationTests.java rename to plugins/riot/src/test/java/com/redis/riot/cli/ReplicationTests.java index 2995049f9..7772eb63d 100644 --- a/plugins/riot/src/test/java/com/redis/riot/cli/AbstractReplicationTests.java +++ b/plugins/riot/src/test/java/com/redis/riot/cli/ReplicationTests.java @@ -16,7 +16,7 @@ import io.lettuce.core.cluster.SlotHash; -abstract class AbstractReplicationTests extends AbstractRiotTestBase { +abstract class ReplicationTests extends AbstractRiotTestBase { @BeforeAll void setDefaults() { @@ -32,7 +32,7 @@ void replicate(TestInfo info) throws Throwable { } @Test - void dryRun(TestInfo info) throws Throwable { + void replicateDryRun(TestInfo info) throws Throwable { String filename = "replicate-dry-run"; generate(info, generator(73)); Assertions.assertTrue(redisCommands.dbsize() > 0); @@ -41,7 +41,7 @@ void dryRun(TestInfo info) throws Throwable { } @Test - void hll(TestInfo info) throws Throwable { + void replicateHyperloglog(TestInfo info) throws Throwable { String key = "crawled:20171124"; String value = "http://www.google.com/"; redisCommands.pfadd(key, value); @@ -52,7 +52,7 @@ void hll(TestInfo info) throws Throwable { } @Test - void keyProcessor(TestInfo info) throws Throwable { + void replicateKeyProcessor(TestInfo info) throws Throwable { String filename = "replicate-key-processor"; GeneratorItemReader gen = generator(1, Type.HASH); generate(info, gen); @@ -64,22 +64,7 @@ void keyProcessor(TestInfo info) throws Throwable { } @Test - void keyExclude(TestInfo info) throws Throwable { - String filename = "replicate-key-exclude"; - int goodCount = 200; - GeneratorItemReader gen = generator(goodCount, Type.HASH); - generate(info, gen); - int badCount = 100; - GeneratorItemReader generator2 = generator(badCount, Type.HASH); - generator2.setKeyspace("bad"); - generate(testInfo(info, "2"), generator2); - Assertions.assertEquals(badCount, keyCount("bad:*")); - execute(info, filename); - Assertions.assertEquals(goodCount, targetRedisCommands.keys("gen:*").size()); - } - - @Test - void liveKeyExclude(TestInfo info) throws Throwable { + void replicateLiveKeyExclude(TestInfo info) throws Throwable { int goodCount = 200; int badCount = 100; enableKeyspaceNotifications(); @@ -95,22 +80,22 @@ void liveKeyExclude(TestInfo info) throws Throwable { } @Test - void live(TestInfo info) throws Exception { + void replicateLive(TestInfo info) throws Exception { runLiveReplication(info, "replicate-live"); } @Test - void threads(TestInfo info) throws Exception { + void replicateLiveThreads(TestInfo info) throws Exception { runLiveReplication(info, "replicate-live-threads"); } @Test - void liveStruct(TestInfo info) throws Exception { + void replicateLiveStruct(TestInfo info) throws Exception { runLiveReplication(info, "replicate-live-struct"); } @Test - void liveOnlyStruct(TestInfo info) throws Exception { + void replicateLiveOnlyStruct(TestInfo info) throws Exception { Type[] types = new Type[] { Type.HASH, Type.STRING }; enableKeyspaceNotifications(); GeneratorItemReader generator = generator(3500, types); @@ -123,7 +108,7 @@ void liveOnlyStruct(TestInfo info) throws Exception { } @Test - void liveKeySlot(TestInfo info) throws Exception { + void replicateLiveKeySlot(TestInfo info) throws Exception { String filename = "replicate-live-keyslot"; enableKeyspaceNotifications(); GeneratorItemReader generator = generator(300); @@ -137,7 +122,7 @@ void liveKeySlot(TestInfo info) throws Exception { } @Test - void struct(TestInfo info) throws Throwable { + void replicateStruct(TestInfo info) throws Throwable { String filename = "replicate-struct"; GeneratorItemReader generator = generator(12000); generate(info, generator); diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/AbstractDbTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/RiotDbTests.java similarity index 97% rename from plugins/riot/src/test/java/com/redis/riot/cli/AbstractDbTests.java rename to plugins/riot/src/test/java/com/redis/riot/cli/RiotDbTests.java index 4bd489323..ffae040ab 100644 --- a/plugins/riot/src/test/java/com/redis/riot/cli/AbstractDbTests.java +++ b/plugins/riot/src/test/java/com/redis/riot/cli/RiotDbTests.java @@ -21,7 +21,7 @@ import picocli.CommandLine.ExitCode; import picocli.CommandLine.ParseResult; -abstract class AbstractDbTests extends AbstractRiotTestBase { +abstract class RiotDbTests extends AbstractRiotTestBase { private static final RedisStackContainer redis = new RedisStackContainer( RedisStackContainer.DEFAULT_IMAGE_NAME.withTag(RedisStackContainer.DEFAULT_TAG)); diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/StackToEnterpriseContainerReplicationTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/StackEnterpriseContainerReplicationTests.java similarity index 87% rename from plugins/riot/src/test/java/com/redis/riot/cli/StackToEnterpriseContainerReplicationTests.java rename to plugins/riot/src/test/java/com/redis/riot/cli/StackEnterpriseContainerReplicationTests.java index 85043a84e..458c6d308 100644 --- a/plugins/riot/src/test/java/com/redis/riot/cli/StackToEnterpriseContainerReplicationTests.java +++ b/plugins/riot/src/test/java/com/redis/riot/cli/StackEnterpriseContainerReplicationTests.java @@ -7,7 +7,7 @@ import com.redis.testcontainers.RedisStackContainer; @EnabledOnOs(OS.LINUX) -class StackToEnterpriseContainerReplicationTests extends AbstractReplicationTests { +class StackEnterpriseContainerReplicationTests extends ReplicationTests { private static final RedisStackContainer source = RedisContainerFactory.stack(); private static final RedisEnterpriseContainer target = RedisContainerFactory.enterprise(); diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/StackToEnterpriseServerReplicationTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/StackEnterpriseServerReplicationTests.java similarity index 88% rename from plugins/riot/src/test/java/com/redis/riot/cli/StackToEnterpriseServerReplicationTests.java rename to plugins/riot/src/test/java/com/redis/riot/cli/StackEnterpriseServerReplicationTests.java index d5605d667..669377b22 100644 --- a/plugins/riot/src/test/java/com/redis/riot/cli/StackToEnterpriseServerReplicationTests.java +++ b/plugins/riot/src/test/java/com/redis/riot/cli/StackEnterpriseServerReplicationTests.java @@ -6,7 +6,7 @@ import com.redis.testcontainers.RedisStackContainer; @EnabledIfEnvironmentVariable(named = RedisEnterpriseServer.ENV_HOST, matches = ".*") -public class StackToEnterpriseServerReplicationTests extends AbstractReplicationTests { +public class StackEnterpriseServerReplicationTests extends ReplicationTests { private static final RedisStackContainer source = RedisContainerFactory.stack(); private static final RedisEnterpriseServer target = RedisContainerFactory.enterpriseServer(); diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/StackToStackReplicationTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/StackToStackReplicationTests.java deleted file mode 100644 index 82074b21f..000000000 --- a/plugins/riot/src/test/java/com/redis/riot/cli/StackToStackReplicationTests.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.redis.riot.cli; - -import com.redis.testcontainers.RedisStackContainer; - -class StackToStackReplicationTests extends AbstractReplicationTests { - - private static final RedisStackContainer source = RedisContainerFactory.stack(); - private static final RedisStackContainer target = RedisContainerFactory.stack(); - - @Override - protected RedisStackContainer getRedisServer() { - return source; - } - - @Override - protected RedisStackContainer getTargetRedisServer() { - return target; - } - -} diff --git a/plugins/riot/src/test/java/com/redis/riot/cli/StackToStackIntegrationTests.java b/plugins/riot/src/test/java/com/redis/riot/cli/StackToStackTests.java similarity index 96% rename from plugins/riot/src/test/java/com/redis/riot/cli/StackToStackIntegrationTests.java rename to plugins/riot/src/test/java/com/redis/riot/cli/StackToStackTests.java index f50ec0eaf..9c16d78f6 100644 --- a/plugins/riot/src/test/java/com/redis/riot/cli/StackToStackIntegrationTests.java +++ b/plugins/riot/src/test/java/com/redis/riot/cli/StackToStackTests.java @@ -39,6 +39,7 @@ import com.redis.spring.batch.KeyValue; import com.redis.spring.batch.KeyValue.DataType; import com.redis.spring.batch.gen.GeneratorItemReader; +import com.redis.spring.batch.gen.Item.Type; import com.redis.spring.batch.reader.MemKeyValue; import com.redis.testcontainers.RedisStackContainer; @@ -48,10 +49,7 @@ import picocli.CommandLine.ExitCode; import picocli.CommandLine.ParseResult; -class StackToStackIntegrationTests extends AbstractRiotTestBase { - - public static final int BEER_CSV_COUNT = 2410; - public static final int BEER_JSON_COUNT = 216; +class StackToStackTests extends ReplicationTests { private static final RedisStackContainer source = RedisContainerFactory.stack(); private static final RedisStackContainer target = RedisContainerFactory.stack(); @@ -66,6 +64,9 @@ protected RedisStackContainer getTargetRedisServer() { return target; } + public static final int BEER_CSV_COUNT = 2410; + public static final int BEER_JSON_COUNT = 216; + private static Path tempDir; @BeforeAll @@ -495,4 +496,18 @@ void generateTypes(TestInfo info) throws Exception { redisCommands.dbsize()); } + @Test + void replicateKeyExclude(TestInfo info) throws Throwable { + String filename = "replicate-key-exclude"; + int goodCount = 200; + GeneratorItemReader gen = generator(goodCount, Type.HASH); + generate(info, gen); + int badCount = 100; + GeneratorItemReader generator2 = generator(badCount, Type.HASH); + generator2.setKeyspace("bad"); + generate(testInfo(info, "2"), generator2); + Assertions.assertEquals(badCount, keyCount("bad:*")); + execute(info, filename); + Assertions.assertEquals(goodCount, targetRedisCommands.keys("gen:*").size()); + } }