Skip to content

Commit

Permalink
fix: don't send status if source exited with non zero (#13190)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmoriceau committed Jul 21, 2024
1 parent b072cfe commit 67ec502
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ class StreamStatusCompletionTracker(
exitCode: Int,
namespacingMapper: AirbyteMapper,
): List<AirbyteMessage> {
if (!shouldEmitStreamStatus) {
if (!shouldEmitStreamStatus || exitCode != 0) {
return listOf()
}
return if (0 == exitCode) {
streamDescriptorsToCompleteStatusMessage(hasCompletedStatus.keys, namespacingMapper)
} else {
streamDescriptorsToCompleteStatusMessage(hasCompletedStatus.filter { it.value }.keys, namespacingMapper)
}
return streamDescriptorsToCompleteStatusMessage(hasCompletedStatus.keys, namespacingMapper)
}

private fun streamDescriptorsToCompleteStatusMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,12 @@ internal class StreamStatusCompletionTrackerTest {
}

@Test
fun `test that we get the status of the streams that send a status if the exit code is 1 and no stream status is send`() {
fun `test that we get not stream status if the exit code is 1 even the source emitted some stream status`() {
streamStatusCompletionTracker.startTracking(catalog, true)
streamStatusCompletionTracker.track(getStreamStatusCompletedMessage("name1").trace.streamStatus)
val result = streamStatusCompletionTracker.finalize(1, mapper)

assertEquals(
listOf(
getStreamStatusCompletedMessage("name1"),
),
result,
)
assertEquals(listOf<AirbyteMessage>(), result)
}

@Test
Expand Down

0 comments on commit 67ec502

Please sign in to comment.