From ed3c4a15782f4db005cd26917bad12e592503408 Mon Sep 17 00:00:00 2001 From: Toshiya Kobayashi Date: Mon, 23 Sep 2024 23:45:59 +0900 Subject: [PATCH] [incubator-kie-drools-6093] flaky test: org.drools.compiler.integrationtests.TimerAndCalendarFireUntilHaltTest (#6096) --- .../TimerAndCalendarFireUntilHaltTest.java | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/TimerAndCalendarFireUntilHaltTest.java b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/TimerAndCalendarFireUntilHaltTest.java index c36fac63bc9..5022ae79916 100644 --- a/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/TimerAndCalendarFireUntilHaltTest.java +++ b/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/TimerAndCalendarFireUntilHaltTest.java @@ -109,9 +109,12 @@ public void testTimerRuleFires() throws Exception { startEngine(); activateRule(); - advanceTimerOneSecond(); - await().until(ruleHasFired("TimerRule", 1)); + + advanceTimerOneSecond(); + await().until(ruleHasFired("TimerRule", 2)); + + stopEngine(); } @Test(timeout = 10000) @@ -126,14 +129,17 @@ public void testTimerRuleHaltStopsFiring() throws Exception { "end"; setupKSessionFor(drl); startEngine(); + activateRule(); - advanceTimerOneSecond(); await().until(ruleHasFired("TimerRule", 1)); + + advanceTimerOneSecond(); + await().until(ruleHasFired("TimerRule", 2)); stopEngine(); advanceTimerOneSecond(); - await().during(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(2)).until(ruleHasFired("TimerRule", 1)); + await().during(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(2)).until(ruleHasFired("TimerRule", 2)); } @Test(timeout = 10000) @@ -148,15 +154,20 @@ public void testTimerRuleRestartsAfterStop() throws Exception { "end"; setupKSessionFor(drl); startEngine(); + activateRule(); - advanceTimerOneSecond(); await().until(ruleHasFired("TimerRule", 1)); + + advanceTimerOneSecond(); + await().until(ruleHasFired("TimerRule", 2)); stopEngine(); startEngine(); advanceTimerOneSecond(); - await().during(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(2)).until(ruleHasFired("TimerRule", 2)); + await().during(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(2)).until(ruleHasFired("TimerRule", 3)); + + stopEngine(); } @Test(timeout = 10000) @@ -171,18 +182,21 @@ public void testTimerRuleDoesRestartsIfNoLongerHolds() throws Exception { "end"; setupKSessionFor(drl); startEngine(); + activateRule(); - advanceTimerOneSecond(); - await().until(ruleHasFired("TimerRule", 1)); + + advanceTimerOneSecond(); + await().until(ruleHasFired("TimerRule", 2)); stopEngine(); disactivateRule(); startEngine(); advanceTimerOneSecond(); + await().during(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(2)).until(ruleHasFired("TimerRule", 2)); - await().during(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(2)).until(ruleHasFired("TimerRule", 1)); + stopEngine(); }