Commit fa588d8948c174b1ec18ab10e82c577258a12684
1 parent
89e05b68
Black box tests startup improvements
Showing
2 changed files
with
25 additions
and
12 deletions
... | ... | @@ -35,7 +35,7 @@ |
35 | 35 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
36 | 36 | <main.dir>${basedir}/../..</main.dir> |
37 | 37 | <blackBoxTests.skip>true</blackBoxTests.skip> |
38 | - <testcontainers.version>1.9.1</testcontainers.version> | |
38 | + <testcontainers.version>1.11.4</testcontainers.version> | |
39 | 39 | <zeroturnaround.version>1.10</zeroturnaround.version> |
40 | 40 | <httpclient.version>4.5.13</httpclient.version> |
41 | 41 | </properties> | ... | ... |
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.msa; |
17 | 17 | |
18 | +import lombok.extern.slf4j.Slf4j; | |
18 | 19 | import org.junit.ClassRule; |
19 | 20 | import org.junit.extensions.cpsuite.ClasspathSuite; |
20 | 21 | import org.junit.rules.ExternalResource; |
... | ... | @@ -32,6 +33,7 @@ import java.util.Map; |
32 | 33 | |
33 | 34 | @RunWith(ClasspathSuite.class) |
34 | 35 | @ClasspathSuite.ClassnameFilters({"org.thingsboard.server.msa.*Test"}) |
36 | +@Slf4j | |
35 | 37 | public class ContainerTestSuite { |
36 | 38 | |
37 | 39 | private static DockerComposeContainer<?> testContainer; |
... | ... | @@ -43,17 +45,28 @@ public class ContainerTestSuite { |
43 | 45 | public static DockerComposeContainer getTestContainer() { |
44 | 46 | if (testContainer == null) { |
45 | 47 | boolean skipTailChildContainers = Boolean.valueOf(System.getProperty("blackBoxTests.skipTailChildContainers")); |
46 | - testContainer = new DockerComposeContainer<>( | |
47 | - new File("./../../docker/docker-compose.yml"), | |
48 | - new File("./../../docker/docker-compose.postgres.yml"), | |
49 | - new File("./../../docker/docker-compose.postgres.volumes.yml"), | |
50 | - new File("./../../docker/docker-compose.kafka.yml")) | |
51 | - .withPull(false) | |
52 | - .withLocalCompose(true) | |
53 | - .withTailChildContainers(!skipTailChildContainers) | |
54 | - .withEnv(installTb.getEnv()) | |
55 | - .withEnv("LOAD_BALANCER_NAME", "") | |
56 | - .withExposedService("haproxy", 80, Wait.forHttp("/swagger-ui.html").withStartupTimeout(Duration.ofSeconds(400))); | |
48 | + try { | |
49 | + String logRegexp = ".*Going to recalculate partitions.*"; | |
50 | + | |
51 | + testContainer = new DockerComposeContainer<>( | |
52 | + new File("./../../docker/docker-compose.yml"), | |
53 | + new File("./../../docker/docker-compose.postgres.yml"), | |
54 | + new File("./../../docker/docker-compose.postgres.volumes.yml"), | |
55 | + new File("./../../docker/docker-compose.kafka.yml")) | |
56 | + .withPull(false) | |
57 | + .withLocalCompose(true) | |
58 | + .withTailChildContainers(!skipTailChildContainers) | |
59 | + .withEnv(installTb.getEnv()) | |
60 | + .withEnv("LOAD_BALANCER_NAME", "") | |
61 | + .withExposedService("haproxy", 80, Wait.forHttp("/swagger-ui.html").withStartupTimeout(Duration.ofSeconds(400))) | |
62 | + .waitingFor("tb-http-transport1", Wait.forLogMessage(logRegexp, 1).withStartupTimeout(Duration.ofSeconds(400))) | |
63 | + .waitingFor("tb-http-transport2", Wait.forLogMessage(logRegexp, 1).withStartupTimeout(Duration.ofSeconds(400))) | |
64 | + .waitingFor("tb-mqtt-transport1", Wait.forLogMessage(logRegexp, 1).withStartupTimeout(Duration.ofSeconds(400))) | |
65 | + .waitingFor("tb-mqtt-transport2", Wait.forLogMessage(logRegexp, 1).withStartupTimeout(Duration.ofSeconds(400))); | |
66 | + } catch (Exception e) { | |
67 | + log.error("Failed to create test container", e); | |
68 | + throw e; | |
69 | + } | |
57 | 70 | } |
58 | 71 | return testContainer; |
59 | 72 | } | ... | ... |