File tree Expand file tree Collapse file tree 4 files changed +12
-10
lines changed
airbyte-commons-worker/src
main/kotlin/io/airbyte/workers/internal
test/kotlin/io/airbyte/workers/internal Expand file tree Collapse file tree 4 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ data class ContainerIOHandle(
30
30
private val terminationFile : File ,
31
31
) {
32
32
companion object {
33
- const val EXIT_CODE_CHECK_FAILURE = " No exit code found."
33
+ const val EXIT_CODE_CHECK_EXISTS_FAILURE = " No exit code found."
34
+ const val EXIT_CODE_CHECK_NOT_EMPTY_FAILURE = " Exit code file empty."
34
35
const val TERMINATION_FILE_BODY = " TERMINATE"
35
36
36
37
/* *
@@ -100,8 +101,8 @@ data class ContainerIOHandle(
100
101
fun exitCodeExists (): Boolean = exitValueFile.exists()
101
102
102
103
fun getExitCode (): Int {
103
- check(exitCodeExists()) { EXIT_CODE_CHECK_FAILURE }
104
- check(exitValueFile.readText().isNotEmpty()) { EXIT_CODE_CHECK_FAILURE }
104
+ check(exitCodeExists()) { EXIT_CODE_CHECK_EXISTS_FAILURE }
105
+ check(exitValueFile.readText().isNotEmpty()) { EXIT_CODE_CHECK_NOT_EMPTY_FAILURE }
105
106
return exitValueFile.readText().trim().toInt()
106
107
}
107
108
Original file line number Diff line number Diff line change 4
4
5
5
package io.airbyte.workers.internal
6
6
7
- import io.airbyte.workers.internal.ContainerIOHandle.Companion.EXIT_CODE_CHECK_FAILURE
7
+ import io.airbyte.workers.internal.ContainerIOHandle.Companion.EXIT_CODE_CHECK_EXISTS_FAILURE
8
+ import io.airbyte.workers.internal.ContainerIOHandle.Companion.EXIT_CODE_CHECK_NOT_EMPTY_FAILURE
8
9
import io.airbyte.workers.internal.ContainerIOHandle.Companion.TERMINATION_FILE_BODY
9
10
import io.mockk.mockk
10
11
import org.junit.jupiter.api.AfterEach
@@ -70,7 +71,7 @@ internal class ContainerIOHandleTest {
70
71
internal fun testGetErrorCode () {
71
72
// File exists but is empty
72
73
val emptyFileError = assertThrows(IllegalStateException ::class .java, containerIOHandle::getExitCode)
73
- assertEquals(EXIT_CODE_CHECK_FAILURE , emptyFileError.message)
74
+ assertEquals(EXIT_CODE_CHECK_NOT_EMPTY_FAILURE , emptyFileError.message)
74
75
75
76
// File exists and contains an exit value
76
77
val exitCode = - 122
@@ -80,7 +81,7 @@ internal class ContainerIOHandleTest {
80
81
// File does not exist
81
82
exitValueFile.delete()
82
83
val notExistError = assertThrows(IllegalStateException ::class .java, containerIOHandle::getExitCode)
83
- assertEquals(EXIT_CODE_CHECK_FAILURE , notExistError.message)
84
+ assertEquals(EXIT_CODE_CHECK_EXISTS_FAILURE , notExistError.message)
84
85
}
85
86
86
87
@Test
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ package io.airbyte.workers.internal
7
7
import io.airbyte.config.WorkerDestinationConfig
8
8
import io.airbyte.protocol.models.AirbyteMessage
9
9
import io.airbyte.workers.exception.WorkerException
10
- import io.airbyte.workers.internal.ContainerIOHandle.Companion.EXIT_CODE_CHECK_FAILURE
10
+ import io.airbyte.workers.internal.ContainerIOHandle.Companion.EXIT_CODE_CHECK_EXISTS_FAILURE
11
11
import io.mockk.every
12
12
import io.mockk.mockk
13
13
import io.mockk.verify
@@ -251,7 +251,7 @@ internal class LocalContainerAirbyteDestinationTest {
251
251
252
252
exitValueFile.delete()
253
253
val error = assertThrows(IllegalStateException ::class .java, { destination.exitValue })
254
- assertEquals(EXIT_CODE_CHECK_FAILURE , error.message)
254
+ assertEquals(EXIT_CODE_CHECK_EXISTS_FAILURE , error.message)
255
255
}
256
256
257
257
@Test
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ package io.airbyte.workers.internal
7
7
import io.airbyte.config.WorkerSourceConfig
8
8
import io.airbyte.protocol.models.AirbyteMessage
9
9
import io.airbyte.workers.exception.WorkerException
10
- import io.airbyte.workers.internal.ContainerIOHandle.Companion.EXIT_CODE_CHECK_FAILURE
10
+ import io.airbyte.workers.internal.ContainerIOHandle.Companion.EXIT_CODE_CHECK_EXISTS_FAILURE
11
11
import io.mockk.every
12
12
import io.mockk.mockk
13
13
import io.mockk.verify
@@ -142,7 +142,7 @@ internal class LocalContainerAirbyteSourceTest {
142
142
143
143
exitValueFile.delete()
144
144
val error = assertThrows(IllegalStateException ::class .java, { source.exitValue })
145
- assertEquals(EXIT_CODE_CHECK_FAILURE , error.message)
145
+ assertEquals(EXIT_CODE_CHECK_EXISTS_FAILURE , error.message)
146
146
}
147
147
148
148
@Test
You can’t perform that action at this time.
0 commit comments