Skip to content

Attempt to minimise WebSocket test flakiness#6045

Merged
yschimke merged 9 commits intosquare:masterfrom
yschimke:cadbury_flakes
May 13, 2020
Merged

Attempt to minimise WebSocket test flakiness#6045
yschimke merged 9 commits intosquare:masterfrom
yschimke:cadbury_flakes

Conversation

@yschimke
Copy link
Copy Markdown
Collaborator

#6033

Assuming this is due to race conditions immediately after shutdown with websocket, allow for 500ms extra before failing. Will record which tests see delays, so we can query for this.

@yschimke yschimke marked this pull request as draft May 11, 2020 21:26
@yschimke yschimke marked this pull request as ready for review May 11, 2020 21:41
@yschimke yschimke requested a review from swankjesse May 12, 2020 17:06

private fun logWithTime(message: String) {
val timeMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs)
val timeMs = if (startNs == 0L) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What’s going on here? Note that 0L is a valid timestamp!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early cancel. I've updated and commented, preferring a masking variable that is immutable to startNs?.run or similar.

}

client.connectionPool().evictAll();
if (client.connectionPool().connectionCount() > 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to OkHttpClientTestRule.ensureAllConnectionsReleased()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... actually it has an assertion for this. Maybe replace that assertion with this?

@After public void tearDown() throws InterruptedException {
clientListener.assertExhausted();

client.connectionPool().evictAll();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, this should be in OkHttpClientTestRule

@yschimke yschimke merged commit fea8fbb into square:master May 13, 2020
@yschimke yschimke deleted the cadbury_flakes branch May 13, 2020 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants