From d1932e61a934c5f422229029b067cb0a29a2b88f Mon Sep 17 00:00:00 2001 From: lprimak Date: Mon, 29 Jun 2026 02:12:46 -0500 Subject: [PATCH 1/3] bugfix(test): fix flaky ExecutorServiceSessionValidationSchedulerTest in core --- ...orServiceSessionValidationSchedulerTest.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/core/src/test/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationSchedulerTest.java b/core/src/test/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationSchedulerTest.java index 0e3a09c96e..3b0d65a0ca 100644 --- a/core/src/test/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationSchedulerTest.java +++ b/core/src/test/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationSchedulerTest.java @@ -23,7 +23,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import java.time.Duration; import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; @SuppressWarnings("checkstyle:MagicNumber") public class ExecutorServiceSessionValidationSchedulerTest { @@ -47,8 +49,9 @@ void timeoutSessionValidate() throws InterruptedException { Session session = new SimpleSession(); session.setTimeout(2000L); defaultSessionManager.create(session); - Thread.sleep(5000L); - assertThat(defaultSessionManager.getActiveSessions()).isEmpty(); + await().atMost(Duration.ofSeconds(10)) + .pollInterval(Duration.ofMillis(100)) + .untilAsserted(() -> assertThat(defaultSessionManager.getActiveSessions()).isEmpty()); assertThat(executorServiceSessionValidationScheduler.isEnabled()).isTrue(); } @@ -59,8 +62,9 @@ void stopSessionValidate() throws InterruptedException { defaultSessionManager.create(session); Thread.sleep(1000L); session.stop(); - Thread.sleep(3000L); - assertThat(defaultSessionManager.getActiveSessions()).isEmpty(); + await().atMost(Duration.ofSeconds(10)) + .pollInterval(Duration.ofMillis(100)) + .untilAsserted(() -> assertThat(defaultSessionManager.getActiveSessions()).isEmpty()); assertThat(executorServiceSessionValidationScheduler.isEnabled()).isTrue(); } @@ -88,8 +92,9 @@ void threadException() throws InterruptedException { defaultSessionManager.create(session); Thread.sleep(2000L); session.stop(); - Thread.sleep(2000L); - assertThat(defaultSessionManager.getActiveSessions()).isNotEmpty(); + await().atMost(Duration.ofSeconds(10)) + .pollInterval(Duration.ofMillis(100)) + .untilAsserted(() -> assertThat(defaultSessionManager.getActiveSessions()).isNotEmpty()); assertThat(executorServiceSessionValidationScheduler.isEnabled()).isTrue(); } From abf0da13319b99422fc50b1018a3c5e2eab7547e Mon Sep 17 00:00:00 2001 From: lprimak Date: Mon, 29 Jun 2026 02:19:07 -0500 Subject: [PATCH 2/3] enh(codespell): added atMost to dictionary --- .github/linters/codespell.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/linters/codespell.txt b/.github/linters/codespell.txt index 3459c9359c..2734b34ff8 100644 --- a/.github/linters/codespell.txt +++ b/.github/linters/codespell.txt @@ -13,3 +13,4 @@ tast te testin tru +atMost From 214550c43a3e7fed01dd581a9bf1b1798919502c Mon Sep 17 00:00:00 2001 From: lprimak Date: Mon, 29 Jun 2026 02:22:21 -0500 Subject: [PATCH 3/3] more codespell --- .github/linters/codespell.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/linters/codespell.txt b/.github/linters/codespell.txt index 2734b34ff8..6ae8a35cf1 100644 --- a/.github/linters/codespell.txt +++ b/.github/linters/codespell.txt @@ -2,6 +2,7 @@ afile afterall aline atleast +atmost bais bu crypted @@ -13,4 +14,3 @@ tast te testin tru -atMost