@@ -25,7 +25,11 @@ import org.junit.jupiter.api.Assertions.assertTrue
25
25
import org.junit.jupiter.api.Test
26
26
import org.junit.jupiter.api.assertAll
27
27
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
+ )
29
33
30
34
open class CheckIntegrationTest <T : ConfigurationSpecification >(
31
35
val successConfigFilenames : List <CheckTestConfig >,
@@ -44,28 +48,29 @@ open class CheckIntegrationTest<T : ConfigurationSpecification>(
44
48
) {
45
49
@Test
46
50
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 ))
49
53
val process =
50
54
destinationProcessFactory.createDestinationProcess(
51
55
" check" ,
52
56
configContents = config,
53
- featureFlags = featureFlags.toTypedArray(),
57
+ featureFlags = tc. featureFlags.toTypedArray(),
54
58
micronautProperties = micronautProperties,
55
59
)
56
60
runBlocking { process.run () }
57
61
val messages = process.readMessages()
58
62
val checkMessages = messages.filter { it.type == AirbyteMessage .Type .CONNECTION_STATUS }
63
+ val testName = tc.name ? : " "
59
64
60
65
assertEquals(
61
66
checkMessages.size,
62
67
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 "
64
69
)
65
70
assertEquals(
66
71
AirbyteConnectionStatus .Status .SUCCEEDED ,
67
72
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} "
69
74
)
70
75
}
71
76
}
@@ -85,20 +90,27 @@ open class CheckIntegrationTest<T : ConfigurationSpecification>(
85
90
runBlocking { process.run () }
86
91
val messages = process.readMessages()
87
92
val checkMessages = messages.filter { it.type == AirbyteMessage .Type .CONNECTION_STATUS }
93
+ val testName = checkTestConfig.name ? : " "
88
94
89
95
assertEquals(
90
96
checkMessages.size,
91
97
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 "
93
99
)
94
100
95
101
val connectionStatus = checkMessages.first().connectionStatus
96
102
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
+ },
98
110
{
99
111
assertTrue(
100
112
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} "
102
114
)
103
115
}
104
116
)
0 commit comments