From 75f662d619918f5bcb56a3a8fd320ac673b6e97f Mon Sep 17 00:00:00 2001 From: Thiago Hora Date: Tue, 3 Sep 2024 13:21:02 +0200 Subject: [PATCH 1/2] [NA] Add log level env vars --- apps/opik-backend/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/opik-backend/config.yml b/apps/opik-backend/config.yml index 88cf015815..3296b1407a 100644 --- a/apps/opik-backend/config.yml +++ b/apps/opik-backend/config.yml @@ -1,8 +1,8 @@ --- logging: - level: INFO + level: ${GENERAL_LOGS_LEVEL:-INFO} loggers: - com.comet: DEBUG + com.comet: ${OPIK_LOGS_LEVEL:-INFO} database: url: ${STATE_DB_URL:-jdbc:mysql://localhost:3306/opik?createDatabaseIfNotExist=true&rewriteBatchedStatements=true} From 1ea9be6c50413d736421052aade157a558f545e5 Mon Sep 17 00:00:00 2001 From: Thiago Hora Date: Wed, 4 Sep 2024 00:05:17 +0200 Subject: [PATCH 2/2] NA: Reuse test containers --- .github/workflows/backend_tests.yml | 2 ++ .../opik/api/resources/v1/priv/DatasetsResourceTest.java | 4 ---- .../opik/api/resources/v1/priv/ExperimentsResourceTest.java | 4 ---- .../resources/v1/priv/FeedbackDefinitionResourceTest.java | 3 --- .../opik/api/resources/v1/priv/ProjectsResourceTest.java | 3 --- .../comet/opik/api/resources/v1/priv/SpansResourceTest.java | 6 ++---- .../opik/api/resources/v1/priv/TracesResourceTest.java | 4 ---- .../opik/infrastructure/HealthCheckIntegrationTest.java | 4 ---- .../auth/AuthModuleNoAuthIntegrationTest.java | 4 ---- .../comet/opik/infrastructure/health/IsAliveE2ETest.java | 4 ---- .../redis/RedissonLockServiceIntegrationTest.java | 4 ---- 11 files changed, 4 insertions(+), 38 deletions(-) diff --git a/.github/workflows/backend_tests.yml b/.github/workflows/backend_tests.yml index ae085d166a..bb1469c939 100644 --- a/.github/workflows/backend_tests.yml +++ b/.github/workflows/backend_tests.yml @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/DatasetsResourceTest.java b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/DatasetsResourceTest.java index 0140293c6b..7468933778 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/DatasetsResourceTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/DatasetsResourceTest.java @@ -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; @@ -114,13 +113,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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/ExperimentsResourceTest.java b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/ExperimentsResourceTest.java index a14571047e..7a85df4011 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/ExperimentsResourceTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/ExperimentsResourceTest.java @@ -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; @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/FeedbackDefinitionResourceTest.java b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/FeedbackDefinitionResourceTest.java index b7f5e51b1f..27f543ce41 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/FeedbackDefinitionResourceTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/FeedbackDefinitionResourceTest.java @@ -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; @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/ProjectsResourceTest.java b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/ProjectsResourceTest.java index ee87e6837c..117fabcd7d 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/ProjectsResourceTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/ProjectsResourceTest.java @@ -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; @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/SpansResourceTest.java b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/SpansResourceTest.java index 3d0acba4ca..39a92f3e5b 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/SpansResourceTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/SpansResourceTest.java @@ -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; @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/TracesResourceTest.java b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/TracesResourceTest.java index 013414cb70..74687bfee5 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/TracesResourceTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/TracesResourceTest.java @@ -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; @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/HealthCheckIntegrationTest.java b/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/HealthCheckIntegrationTest.java index 0913c25e86..e323776f4c 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/HealthCheckIntegrationTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/HealthCheckIntegrationTest.java @@ -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; @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/auth/AuthModuleNoAuthIntegrationTest.java b/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/auth/AuthModuleNoAuthIntegrationTest.java index 97659995c3..d772e880bc 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/auth/AuthModuleNoAuthIntegrationTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/auth/AuthModuleNoAuthIntegrationTest.java @@ -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; @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/health/IsAliveE2ETest.java b/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/health/IsAliveE2ETest.java index 957d3f05dc..93ab7e9f5e 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/health/IsAliveE2ETest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/health/IsAliveE2ETest.java @@ -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; @@ -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 diff --git a/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/redis/RedissonLockServiceIntegrationTest.java b/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/redis/RedissonLockServiceIntegrationTest.java index 93b082e36a..728921b170 100644 --- a/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/redis/RedissonLockServiceIntegrationTest.java +++ b/apps/opik-backend/src/test/java/com/comet/opik/infrastructure/redis/RedissonLockServiceIntegrationTest.java @@ -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; @@ -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