Skip to content

Commit

Permalink
NA: Reuse test containers (#173)
Browse files Browse the repository at this point in the history
* [NA] Add log level env vars

* NA: Reuse test containers
  • Loading branch information
thiagohora authored Sep 4, 2024
1 parent 6d9fd76 commit c04d447
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/backend_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
cache: maven

- name: Run Tests for backend
env:
TESTCONTAINERS_REUSE_ENABLE: true
run: mvn clean test -Dmaven.test.failure.ignore=true

- name: Publish Test Report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.junit.jupiter.params.provider.ValueSource;
import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import ru.vyarus.dropwizard.guice.test.ClientSupport;
import ru.vyarus.dropwizard.guice.test.jupiter.ext.TestDropwizardAppExtension;
Expand Down Expand Up @@ -113,13 +112,10 @@ class DatasetsResourceTest {

private static final TimeBasedEpochGenerator GENERATOR = Generators.timeBasedEpochGenerator();

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MYSQL = MySQLContainerUtils.newMySQLContainer();

@Container
private static final ClickHouseContainer CLICKHOUSE = ClickHouseContainerUtils.newClickHouseContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import ru.vyarus.dropwizard.guice.test.ClientSupport;
import ru.vyarus.dropwizard.guice.test.jupiter.ext.TestDropwizardAppExtension;
Expand Down Expand Up @@ -102,13 +101,10 @@ class ExperimentsResourceTest {

private static final TimeBasedEpochGenerator GENERATOR = Generators.timeBasedEpochGenerator();

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MY_SQL_CONTAINER = MySQLContainerUtils.newMySQLContainer();

@Container
private static final ClickHouseContainer CLICK_HOUSE_CONTAINER = ClickHouseContainerUtils.newClickHouseContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import ru.vyarus.dropwizard.guice.test.ClientSupport;
import ru.vyarus.dropwizard.guice.test.jupiter.ext.TestDropwizardAppExtension;
Expand Down Expand Up @@ -78,10 +77,8 @@ class FeedbackDefinitionResourceTest {
private static final String WORKSPACE_ID = UUID.randomUUID().toString();
private static final String TEST_WORKSPACE = UUID.randomUUID().toString();

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MYSQL = MySQLContainerUtils.newMySQLContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import ru.vyarus.dropwizard.guice.test.ClientSupport;
import ru.vyarus.dropwizard.guice.test.jupiter.ext.TestDropwizardAppExtension;
Expand Down Expand Up @@ -69,10 +68,8 @@ class ProjectsResourceTest {
private static final String WORKSPACE_ID = UUID.randomUUID().toString();
private static final String TEST_WORKSPACE = UUID.randomUUID().toString();

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MYSQL = MySQLContainerUtils.newMySQLContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -108,11 +107,10 @@ class SpansResourceTest {
public static final String WORKSPACE_ID = UUID.randomUUID().toString();
private static final Random RANDOM = new Random();

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();
@Container

private static final MySQLContainer<?> MY_SQL_CONTAINER = MySQLContainerUtils.newMySQLContainer();
@Container

private static final ClickHouseContainer CLICK_HOUSE_CONTAINER = ClickHouseContainerUtils.newClickHouseContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.junit.jupiter.params.provider.MethodSource;
import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -105,13 +104,10 @@ class TracesResourceTest {
public static final String WORKSPACE_ID = UUID.randomUUID().toString();
private static final String TEST_WORKSPACE = UUID.randomUUID().toString();

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MYSQL_CONTAINER = MySQLContainerUtils.newMySQLContainer();

@Container
private static final ClickHouseContainer CLICK_HOUSE_CONTAINER = ClickHouseContainerUtils.newClickHouseContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import ru.vyarus.dropwizard.guice.test.ClientSupport;
import ru.vyarus.dropwizard.guice.test.jupiter.ext.TestDropwizardAppExtension;
Expand All @@ -27,13 +26,10 @@
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class HealthCheckIntegrationTest {

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MYSQL = MySQLContainerUtils.newMySQLContainer();

@Container
private static final ClickHouseContainer CLICKHOUSE = ClickHouseContainerUtils.newClickHouseContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import ru.vyarus.dropwizard.guice.test.ClientSupport;
import ru.vyarus.dropwizard.guice.test.jupiter.ext.TestDropwizardAppExtension;
Expand All @@ -35,13 +34,10 @@ class AuthModuleNoAuthIntegrationTest {

public static final String URL_TEMPLATE = "%s/v1/private/projects";

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MYSQL = MySQLContainerUtils.newMySQLContainer();

@Container
private static final ClickHouseContainer CLICKHOUSE = ClickHouseContainerUtils.newClickHouseContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import ru.vyarus.dropwizard.guice.test.ClientSupport;
import ru.vyarus.dropwizard.guice.test.jupiter.ext.TestDropwizardAppExtension;
Expand All @@ -26,13 +25,10 @@
@DisplayName("Is Alive Resource Test")
class IsAliveE2ETest {

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MYSQL = MySQLContainerUtils.newMySQLContainer();

@Container
private static final ClickHouseContainer CLICKHOUSE = ClickHouseContainerUtils.newClickHouseContainer();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand All @@ -29,13 +28,10 @@
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class RedissonLockServiceIntegrationTest {

@Container
private static final RedisContainer REDIS = RedisContainerUtils.newRedisContainer();

@Container
private static final MySQLContainer<?> MYSQL = MySQLContainerUtils.newMySQLContainer();

@Container
private static final ClickHouseContainer CLICKHOUSE = ClickHouseContainerUtils.newClickHouseContainer();

@RegisterExtension
Expand Down

0 comments on commit c04d447

Please sign in to comment.