Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NA: Reuse test containers #173

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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