From bf2f590e734a809f2b579e5543121c7f16f01c85 Mon Sep 17 00:00:00 2001 From: Edward Gao Date: Fri, 25 Apr 2025 10:54:21 -0700 Subject: [PATCH 1/3] run cleaner once per class --- .../io/airbyte/cdk/load/test/util/IntegrationTest.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt b/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt index a7814be706d1..7f79f41026c5 100644 --- a/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt +++ b/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt @@ -67,6 +67,13 @@ abstract class IntegrationTest( // multiple times. val destinationProcessFactory = DestinationProcessFactory.get(additionalMicronautEnvs) + // we want to run the cleaner exactly once per test class. + // technically this is a little inefficient - e.g. multiple test classes could reuse the same + // cleaner, so we'd prefer to only them once. + // but this is simpler to implement than tracking hasRunCleaner across test classes, + // and then also requiring cleaners to be able to recognize themselves as identical. + private val hasRunCleaner = AtomicBoolean(false) + @Suppress("DEPRECATION") private val randomSuffix = RandomStringUtils.randomAlphabetic(4) private val timestampString = LocalDateTime.ofInstant(Instant.now(), ZoneOffset.UTC) @@ -329,8 +336,6 @@ abstract class IntegrationTest( return namespaceCreationDate.isBefore(cleanupCutoffDate) } - private val hasRunCleaner = AtomicBoolean(false) - // Connectors are calling System.getenv rather than using micronaut-y properties, // so we have to mock it out, instead of just setting more properties // inside NonDockerizedDestination. From be637ed96f0fa34023c5155b8f55b448efcd0839 Mon Sep 17 00:00:00 2001 From: Edward Gao Date: Fri, 25 Apr 2025 10:59:37 -0700 Subject: [PATCH 2/3] comment on why not AfterAll --- .../kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt b/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt index 7f79f41026c5..c61d4c7d7cdf 100644 --- a/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt +++ b/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt @@ -72,6 +72,8 @@ abstract class IntegrationTest( // cleaner, so we'd prefer to only them once. // but this is simpler to implement than tracking hasRunCleaner across test classes, // and then also requiring cleaners to be able to recognize themselves as identical. + // (you would think this is just an AfterAll method, but junit requires those to be static, + // so we wouldn't have access to the cleaner instance >.>) private val hasRunCleaner = AtomicBoolean(false) @Suppress("DEPRECATION") private val randomSuffix = RandomStringUtils.randomAlphabetic(4) From 6dcb63104064cdb0db24f08b23f3c25467f38e8f Mon Sep 17 00:00:00 2001 From: Edward Gao Date: Fri, 25 Apr 2025 15:23:17 -0700 Subject: [PATCH 3/3] derp --- .../kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt b/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt index c61d4c7d7cdf..1a5030340778 100644 --- a/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt +++ b/airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/test/util/IntegrationTest.kt @@ -69,7 +69,7 @@ abstract class IntegrationTest( // we want to run the cleaner exactly once per test class. // technically this is a little inefficient - e.g. multiple test classes could reuse the same - // cleaner, so we'd prefer to only them once. + // cleaner, so we'd prefer to only call each of them once. // but this is simpler to implement than tracking hasRunCleaner across test classes, // and then also requiring cleaners to be able to recognize themselves as identical. // (you would think this is just an AfterAll method, but junit requires those to be static,