Skip to content

Commit

Permalink
Refactor ZK prefix due to inconsistency and collisions on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlb committed Feb 15, 2024
1 parent 026e011 commit 06a76fc
Show file tree
Hide file tree
Showing 27 changed files with 53 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.async.AsyncCuratorFramework;
Expand Down Expand Up @@ -61,7 +62,7 @@ public void bootstrapCluster() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(zkServer.getConnectString())
.setZkPathPrefix("testZK")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleChunkLivecycle")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down Expand Up @@ -450,7 +450,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleChunkLivecycle")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down Expand Up @@ -536,7 +536,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleChunkLivecycle")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.RandomStringUtils;
Expand Down Expand Up @@ -103,7 +104,7 @@ public void shouldHandleChunkLivecycle() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleChunkLivecycle")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down Expand Up @@ -246,7 +247,7 @@ public void shouldHandleMissingS3Assets() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleMissingS3Assets")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down Expand Up @@ -320,7 +321,7 @@ public void shouldHandleMissingZkData() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleMissingZkData")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down Expand Up @@ -394,7 +395,7 @@ public void closeShouldCleanupLiveChunkCorrectly() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleChunkLivecycle")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleChunkLivecycle")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down Expand Up @@ -440,7 +440,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleChunkLivecycle")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down Expand Up @@ -523,7 +523,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("shouldHandleChunkLivecycle")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.commons.lang3.RandomStringUtils;
Expand Down Expand Up @@ -102,7 +103,7 @@ private CachingChunkManager<LogMessage> initChunkManager() throws TimeoutExcepti
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("test")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
Expand Down Expand Up @@ -108,7 +109,7 @@ public class IndexingChunkManagerTest {
private SimpleMeterRegistry metricsRegistry;
private S3AsyncClient s3AsyncClient;

private static final String ZK_PATH_PREFIX = "testZK";
private static final String ZK_PATH_PREFIX = UUID.randomUUID().toString();
private S3CrtBlobFs s3CrtBlobFs;
private TestingServer localZkServer;
private AsyncCuratorFramework curatorFramework;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.IOException;
import java.time.Duration;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.async.AsyncCuratorFramework;
Expand Down Expand Up @@ -48,7 +49,7 @@ public void setup() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("ClusterHpaMetricServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void setup() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("RecoveryTaskAssignmentServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void setup() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("ReplicaAssignmentServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void setup() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("ReplicaCreatorServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void setup() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("ReplicaDeletionServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void setup() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("ReplicaEvictionServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void setUp() throws Exception {
com.slack.kaldb.proto.config.KaldbConfigs.ZookeeperConfig zkConfig =
com.slack.kaldb.proto.config.KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("ReplicaRestoreServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void setup() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("SnapshotDeletionServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(2500)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testZKServer.getConnectString())
.setZkPathPrefix("indexerTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.IOException;
import java.time.Instant;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.async.AsyncCuratorFramework;
Expand All @@ -41,7 +42,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zookeeperConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("Test")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(500)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.curator.RetryPolicy;
Expand Down Expand Up @@ -48,7 +49,7 @@ public void setUp() throws Exception {
zookeeperConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("Test")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(10000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(500)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Queue;
import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -186,7 +187,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig.newBuilder()
// .setZkConnectString("127.0.0.1:2181")
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("Test")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(500)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.async.AsyncCuratorFramework;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -38,7 +39,7 @@ public void setUp() throws Exception {
com.slack.kaldb.proto.config.KaldbConfigs.ZookeeperConfig zkConfig =
com.slack.kaldb.proto.config.KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testZKServer.getConnectString())
.setZkPathPrefix("datasetPartitionMetadataTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.slack.kaldb.proto.config.KaldbConfigs;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import java.io.IOException;
import java.util.UUID;
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.async.AsyncCuratorFramework;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -27,7 +28,7 @@ public void setUp() throws Exception {
KaldbConfigs.ZookeeperConfig zookeeperConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("Test")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(500)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Properties;
import java.util.UUID;
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.async.AsyncCuratorFramework;
import org.apache.kafka.clients.consumer.ConsumerConfig;
Expand Down Expand Up @@ -60,7 +61,7 @@ public void shouldHandleStreamError() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(zkServer.getConnectString())
.setZkPathPrefix("test")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(100)
.setZkConnectionTimeoutMs(100)
.setSleepBetweenRetriesMs(100)
Expand Down Expand Up @@ -127,7 +128,7 @@ public void shouldLoadConfigOnStartAndReloadOnMetadataChange() throws Exception
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(zkServer.getConnectString())
.setZkPathPrefix("test")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(30000)
.setZkConnectionTimeoutMs(30000)
.setSleepBetweenRetriesMs(30000)
Expand Down Expand Up @@ -188,7 +189,7 @@ public void shouldProcessMessageStartToFinish() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(zkServer.getConnectString())
.setZkPathPrefix("test")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(30000)
.setZkConnectionTimeoutMs(30000)
.setSleepBetweenRetriesMs(30000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.async.AsyncCuratorFramework;
import org.apache.kafka.clients.consumer.ConsumerConfig;
Expand Down Expand Up @@ -74,7 +75,7 @@ public void bootstrapCluster() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(zkServer.getConnectString())
.setZkPathPrefix("testZK")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.async.AsyncCuratorFramework;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -36,7 +37,7 @@ public void setup() throws Exception {
KaldbConfigs.ZookeeperConfig zkConfig =
KaldbConfigs.ZookeeperConfig.newBuilder()
.setZkConnectString(testingServer.getConnectString())
.setZkPathPrefix("HpaMetricPublisherServiceTest")
.setZkPathPrefix(UUID.randomUUID().toString())
.setZkSessionTimeoutMs(1000)
.setZkConnectionTimeoutMs(1000)
.setSleepBetweenRetriesMs(1000)
Expand Down
Loading

0 comments on commit 06a76fc

Please sign in to comment.