Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5430: Fix flakes in NetworkLoggingInterceptorTest #5436

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class NetworkLoggingInterceptorTest {
val firstRequestsDeferred = CoroutineScope(backgroundTestDispatcher).async {
networkLoggingInterceptor.logNetworkCallFlow.take(1).toList()
}
testCoroutineDispatchers.advanceUntilIdle() // Ensure the flow is subscribed before emit().
client.newCall(request).execute()
testCoroutineDispatchers.advanceUntilIdle()

Expand All @@ -116,6 +117,7 @@ class NetworkLoggingInterceptorTest {
networkLoggingInterceptor.logFailedNetworkCallFlow.take(1).toList()
}
mockWebServer.enqueue(mockResponse)
testCoroutineDispatchers.advanceUntilIdle() // Ensure the flow is subscribed before emit().
client.newCall(request).execute()
testCoroutineDispatchers.advanceUntilIdle()

Expand All @@ -141,6 +143,7 @@ class NetworkLoggingInterceptorTest {
val firstFailingRequestsDeferred = CoroutineScope(backgroundTestDispatcher).async {
networkLoggingInterceptor.logFailedNetworkCallFlow.take(1).toList()
}
testCoroutineDispatchers.advanceUntilIdle() // Ensure the flow is subscribed before emit().
try {
client.newCall(request).execute()
} catch (e: ConnectException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class ConsoleLoggerTest {
val firstErrorContextsDeferred = CoroutineScope(backgroundTestDispatcher).async {
consoleLogger.logErrorMessagesFlow.take(1).toList()
}

testCoroutineDispatchers.advanceUntilIdle() // Ensure the flow is subscribed before emit().
consoleLogger.e(testTag, testMessage)
testCoroutineDispatchers.advanceUntilIdle()

Expand Down
Loading