|
|
|
@ -29,7 +29,6 @@ import java.nio.file.Path; |
|
|
|
import java.time.Duration; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.UUID; |
|
|
|
@ -46,7 +45,6 @@ public class ContainerTestSuite { |
|
|
|
final static boolean IS_REDIS_SENTINEL = Boolean.parseBoolean(System.getProperty("blackBoxTests.redisSentinel")); |
|
|
|
final static boolean IS_REDIS_SSL = Boolean.parseBoolean(System.getProperty("blackBoxTests.redisSsl")); |
|
|
|
final static boolean IS_HYBRID_MODE = Boolean.parseBoolean(System.getProperty("blackBoxTests.hybridMode")); |
|
|
|
final static String QUEUE_TYPE = System.getProperty("blackBoxTests.queue", "kafka"); |
|
|
|
private static final String SOURCE_DIR = "./../../docker/"; |
|
|
|
private static final String TB_CORE_LOG_REGEXP = ".*Starting polling for events.*"; |
|
|
|
private static final String TRANSPORTS_LOG_REGEXP = ".*Going to recalculate partitions.*"; |
|
|
|
@ -122,45 +120,12 @@ public class ContainerTestSuite { |
|
|
|
new File(targetDir + (IS_HYBRID_MODE ? "docker-compose.hybrid.yml" : "docker-compose.postgres.yml")), |
|
|
|
new File(targetDir + (IS_HYBRID_MODE ? "docker-compose.hybrid-test-extras.yml" : "docker-compose.postgres-test-extras.yml")), |
|
|
|
new File(targetDir + "docker-compose.postgres.volumes.yml"), |
|
|
|
new File(targetDir + "docker-compose." + QUEUE_TYPE + ".yml"), |
|
|
|
new File(targetDir + "docker-compose.kafka.yml"), |
|
|
|
new File(targetDir + resolveRedisComposeFile()), |
|
|
|
new File(targetDir + resolveRedisComposeVolumesFile()), |
|
|
|
new File(targetDir + ("docker-selenium.yml")) |
|
|
|
)); |
|
|
|
|
|
|
|
Map<String, String> queueEnv = new HashMap<>(); |
|
|
|
queueEnv.put("TB_QUEUE_TYPE", QUEUE_TYPE); |
|
|
|
queueEnv.put("TB_QUEUE_PREFIX", "test"); |
|
|
|
switch (QUEUE_TYPE) { |
|
|
|
case "kafka": |
|
|
|
composeFiles.add(new File(targetDir + "docker-compose.kafka.yml")); |
|
|
|
break; |
|
|
|
case "aws-sqs": |
|
|
|
replaceInFile(targetDir, "queue-aws-sqs.env", |
|
|
|
Map.of("YOUR_KEY", getSysProp("blackBoxTests.awsKey"), |
|
|
|
"YOUR_SECRET", getSysProp("blackBoxTests.awsSecret"), |
|
|
|
"YOUR_REGION", getSysProp("blackBoxTests.awsRegion"))); |
|
|
|
break; |
|
|
|
case "rabbitmq": |
|
|
|
composeFiles.add(new File(targetDir + "docker-compose.rabbitmq-server.yml")); |
|
|
|
replaceInFile(targetDir, "queue-rabbitmq.env", |
|
|
|
Map.of("localhost", "rabbitmq")); |
|
|
|
break; |
|
|
|
case "service-bus": |
|
|
|
replaceInFile(targetDir, "queue-service-bus.env", |
|
|
|
Map.of("YOUR_NAMESPACE_NAME", getSysProp("blackBoxTests.serviceBusNamespace"), |
|
|
|
"YOUR_SAS_KEY_NAME", getSysProp("blackBoxTests.serviceBusSASPolicy"))); |
|
|
|
replaceInFile(targetDir, "queue-service-bus.env", |
|
|
|
Map.of("YOUR_SAS_KEY", getSysProp("blackBoxTests.serviceBusPrimaryKey"))); |
|
|
|
break; |
|
|
|
case "pubsub": |
|
|
|
replaceInFile(targetDir, "queue-pubsub.env", |
|
|
|
Map.of("YOUR_PROJECT_ID", getSysProp("blackBoxTests.pubSubProjectId"), |
|
|
|
"YOUR_SERVICE_ACCOUNT", getSysProp("blackBoxTests.pubSubServiceAccount"))); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new RuntimeException("Unsupported queue type: " + QUEUE_TYPE); |
|
|
|
} |
|
|
|
addToFile(targetDir, "queue-kafka.env", Map.of("TB_QUEUE_PREFIX", "test")); |
|
|
|
|
|
|
|
if (IS_HYBRID_MODE) { |
|
|
|
composeFiles.add(new File(targetDir + "docker-compose.cassandra.volumes.yml")); |
|
|
|
@ -172,7 +137,7 @@ public class ContainerTestSuite { |
|
|
|
.withOptions("--compatibility") |
|
|
|
.withTailChildContainers(!skipTailChildContainers) |
|
|
|
.withEnv(installTb.getEnv()) |
|
|
|
.withEnv(queueEnv) |
|
|
|
.withEnv("TB_QUEUE_TYPE", "kafka") |
|
|
|
.withEnv("LOAD_BALANCER_NAME", "") |
|
|
|
.withExposedService("haproxy", 80, Wait.forHttp("/swagger-ui.html").withStartupTimeout(CONTAINER_STARTUP_TIMEOUT)) |
|
|
|
.withExposedService("broker", 1883) |
|
|
|
|