Issue #11676 fix session CreationTest (#11685)

This commit is contained in:
Jan Bartel 2024-04-24 15:42:29 +02:00 committed by GitHub
parent 33a65f636f
commit aef8cb1b50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 9 deletions

View File

@ -200,7 +200,7 @@ public class CreationTest
assertEquals(HttpServletResponse.SC_OK, response.getStatus()); assertEquals(HttpServletResponse.SC_OK, response.getStatus());
//check that the session does not exist //check that the session does not exist
assertFalse(contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id)); Awaitility.waitAtMost(5, TimeUnit.SECONDS).until(() -> !contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id));
} }
finally finally
{ {
@ -245,7 +245,7 @@ public class CreationTest
assertEquals(HttpServletResponse.SC_OK, response.getStatus()); assertEquals(HttpServletResponse.SC_OK, response.getStatus());
//check that the session does not exist //check that the session does not exist
assertFalse(contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id)); Awaitility.waitAtMost(5, TimeUnit.SECONDS).until(() -> !contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id));
} }
finally finally
{ {
@ -287,8 +287,8 @@ public class CreationTest
ContentResponse response = client.GET(url); ContentResponse response = client.GET(url);
assertEquals(HttpServletResponse.SC_OK, response.getStatus()); assertEquals(HttpServletResponse.SC_OK, response.getStatus());
//check that the session does not exist //check the session
assertTrue(contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id)); Awaitility.waitAtMost(5, TimeUnit.SECONDS).until(() -> contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id));
assertThat(response.getHeaders().getValuesList(HttpHeader.SET_COOKIE).size(), Matchers.is(1)); assertThat(response.getHeaders().getValuesList(HttpHeader.SET_COOKIE).size(), Matchers.is(1));
} }
finally finally
@ -338,8 +338,8 @@ public class CreationTest
assertEquals(HttpServletResponse.SC_OK, response.getStatus()); assertEquals(HttpServletResponse.SC_OK, response.getStatus());
//check that the sessions exist persisted //check that the sessions exist persisted
assertTrue(contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id)); Awaitility.waitAtMost(5, TimeUnit.SECONDS).until(() -> contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id));
assertTrue(ctxB.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id)); Awaitility.waitAtMost(5, TimeUnit.SECONDS).until(() -> ctxB.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id));
} }
finally finally
{ {
@ -388,8 +388,8 @@ public class CreationTest
assertEquals(HttpServletResponse.SC_OK, response.getStatus()); assertEquals(HttpServletResponse.SC_OK, response.getStatus());
//check that the session does not exist //check that the session does not exist
assertFalse(contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id)); Awaitility.waitAtMost(5, TimeUnit.SECONDS).until(() -> !contextHandler.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id));
assertFalse(ctxB.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id)); Awaitility.waitAtMost(5, TimeUnit.SECONDS).until(() -> !ctxB.getSessionHandler().getSessionCache().getSessionDataStore().exists(servlet._id));
} }
finally finally
{ {