Skip to content

Commit

Permalink
test(engine): unflake TimerCatchEventTest
Browse files Browse the repository at this point in the history
This test was flawed as it creates a timer with a duration of 100ms. Then it continues to verify it has been triggered after 1 second.

This worked because the engine increased it's time. This happened before the timer was scheduled so in reality the timer would trigger after 1.1 seconds. With the change in the increase time method to wait until the engine is idle before increasing the time this broke, as the timer would now be scheduled for the 100ms mark as expected.
  • Loading branch information
remcowesterhoud committed Nov 2, 2022
1 parent 893f5d5 commit ab1232a
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ public void shouldTriggerTimer() {
.withProcessInstanceKey(processInstanceKey)
.getFirst();

ENGINE.increaseTime(Duration.ofSeconds(1));

// then
final Record<TimerRecordValue> triggeredEvent =
RecordingExporter.timerRecords(TimerIntent.TRIGGERED)
Expand All @@ -215,7 +213,7 @@ public void shouldTriggerTimer() {
assertThat(triggeredEvent.getKey()).isEqualTo(createdEvent.getKey());
assertThat(triggeredEvent.getValue()).isEqualTo(createdEvent.getValue());
assertThat(Duration.ofMillis(triggeredEvent.getTimestamp() - createdEvent.getTimestamp()))
.isGreaterThanOrEqualTo(Duration.ofSeconds(1));
.isCloseTo(Duration.ofMillis(100), Duration.ofMillis(50));
}

@Test
Expand Down

0 comments on commit ab1232a

Please sign in to comment.