Skip to content

Commit

Permalink
Fix race condition on async test for PR #1158 (#1331)
Browse files Browse the repository at this point in the history
* Fix race condition on async test

(cherry picked from commit dc34c54)
  • Loading branch information
andy840314 committed Jul 27, 2021
1 parent edfc6e1 commit 1d2857e
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ public void testParallelPutRequests() throws Exception {
boolean created = false;
for (HttpResponse response : responses) {
int sc = response.getStatusCode();
if (sc == HttpStatus.SC_CREATED) {
Assert.assertFalse(created);
created = true;
} else {
Assert.assertEquals(HttpStatus.SC_CONFLICT, sc);
switch (sc) {
case HttpStatus.SC_CREATED:
Assert.assertFalse(created);
created = true;
break;
case HttpStatus.SC_OK:
break;
default:
Assert.assertEquals(HttpStatus.SC_CONFLICT, sc);
break;
}
}
deleteUser("test1");
Expand Down

0 comments on commit 1d2857e

Please sign in to comment.