Skip to content

Commit c819cc5

Browse files
Add name to Bulk CDK Check Tests (#53191)
Co-authored-by: Octavia Squidington III <[email protected]>
1 parent cee03d5 commit c819cc5

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/check/CheckIntegrationTest.kt

+21-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ import org.junit.jupiter.api.Assertions.assertTrue
2525
import org.junit.jupiter.api.Test
2626
import org.junit.jupiter.api.assertAll
2727

28-
data class CheckTestConfig(val configPath: Path, val featureFlags: Set<FeatureFlag> = emptySet())
28+
data class CheckTestConfig(
29+
val configPath: Path,
30+
val featureFlags: Set<FeatureFlag> = emptySet(),
31+
val name: String? = null,
32+
)
2933

3034
open class CheckIntegrationTest<T : ConfigurationSpecification>(
3135
val successConfigFilenames: List<CheckTestConfig>,
@@ -44,28 +48,29 @@ open class CheckIntegrationTest<T : ConfigurationSpecification>(
4448
) {
4549
@Test
4650
open fun testSuccessConfigs() {
47-
for ((path, featureFlags) in successConfigFilenames) {
48-
val config = updateConfig(Files.readString(path, StandardCharsets.UTF_8))
51+
for (tc in successConfigFilenames) {
52+
val config = updateConfig(Files.readString(tc.configPath, StandardCharsets.UTF_8))
4953
val process =
5054
destinationProcessFactory.createDestinationProcess(
5155
"check",
5256
configContents = config,
53-
featureFlags = featureFlags.toTypedArray(),
57+
featureFlags = tc.featureFlags.toTypedArray(),
5458
micronautProperties = micronautProperties,
5559
)
5660
runBlocking { process.run() }
5761
val messages = process.readMessages()
5862
val checkMessages = messages.filter { it.type == AirbyteMessage.Type.CONNECTION_STATUS }
63+
val testName = tc.name ?: ""
5964

6065
assertEquals(
6166
checkMessages.size,
6267
1,
63-
"Expected to receive exactly one connection status message, but got ${checkMessages.size}: $checkMessages"
68+
"$testName: Expected to receive exactly one connection status message, but got ${checkMessages.size}: $checkMessages"
6469
)
6570
assertEquals(
6671
AirbyteConnectionStatus.Status.SUCCEEDED,
6772
checkMessages.first().connectionStatus.status,
68-
"Expected check to be successful, but message was ${checkMessages.first().connectionStatus}"
73+
"$testName: Expected check to be successful, but message was ${checkMessages.first().connectionStatus}"
6974
)
7075
}
7176
}
@@ -85,20 +90,27 @@ open class CheckIntegrationTest<T : ConfigurationSpecification>(
8590
runBlocking { process.run() }
8691
val messages = process.readMessages()
8792
val checkMessages = messages.filter { it.type == AirbyteMessage.Type.CONNECTION_STATUS }
93+
val testName = checkTestConfig.name ?: ""
8894

8995
assertEquals(
9096
checkMessages.size,
9197
1,
92-
"Expected to receive exactly one connection status message, but got ${checkMessages.size}: $checkMessages"
98+
"$testName: Expected to receive exactly one connection status message, but got ${checkMessages.size}: $checkMessages"
9399
)
94100

95101
val connectionStatus = checkMessages.first().connectionStatus
96102
assertAll(
97-
{ assertEquals(AirbyteConnectionStatus.Status.FAILED, connectionStatus.status) },
103+
{
104+
assertEquals(
105+
AirbyteConnectionStatus.Status.FAILED,
106+
connectionStatus.status,
107+
"$testName: expected check to fail but succeeded",
108+
)
109+
},
98110
{
99111
assertTrue(
100112
failurePattern.matcher(connectionStatus.message).find(),
101-
"Expected to match ${failurePattern.pattern()}, but got ${connectionStatus.message}"
113+
"$testName: Expected to match ${failurePattern.pattern()}, but got ${connectionStatus.message}"
102114
)
103115
}
104116
)

0 commit comments

Comments
 (0)