Skip to content

Commit

Permalink
fix(test): resolve flaky test
Browse files Browse the repository at this point in the history
We are not entirely sure what the cause of the flakyness is, however by improving the assertions to be more specific to what this test is supposed to fix we expect that the flakyness is resolved.

(cherry picked from commit 3ca46f0)
  • Loading branch information
remcowesterhoud authored and github-actions[bot] committed Nov 18, 2022
1 parent f3dd3f6 commit 9ebd9b5
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,27 +356,25 @@ public void shouldTriggerAndCreateProcessInstance() {
.hasVersion(deployedProcess.getVersion())
.hasProcessDefinitionKey(processDefinitionKey);

final long triggerRecordPosition =
RecordingExporter.timerRecords(TimerIntent.TRIGGER)
final var processInstanceKey =
RecordingExporter.processInstanceRecords(ProcessInstanceIntent.ELEMENT_ACTIVATED)
.withProcessDefinitionKey(processDefinitionKey)
.getFirst()
.getPosition();
.getValue()
.getProcessInstanceKey();

assertThat(
RecordingExporter.timerRecords()
.withProcessDefinitionKey(processDefinitionKey)
.skipUntil(r -> r.getPosition() >= triggerRecordPosition)
.limit(2))
.extracting(Record::getIntent)
.containsExactly(TimerIntent.TRIGGER, TimerIntent.TRIGGERED);
RecordingExporter.timerRecords(TimerIntent.TRIGGERED)
.withProcessInstanceKey(processInstanceKey)
.exists())
.isTrue();

assertThat(
RecordingExporter.processInstanceRecords()
.withProcessDefinitionKey(processDefinitionKey)
.skipUntil(r -> r.getPosition() >= triggerRecordPosition)
.limit(4))
.limitToProcessInstanceCompleted())
.extracting(r -> r.getValue().getBpmnElementType(), Record::getIntent)
.containsExactly(
.containsSequence(
tuple(BpmnElementType.PROCESS, ProcessInstanceIntent.ACTIVATE_ELEMENT),
tuple(BpmnElementType.PROCESS, ProcessInstanceIntent.ELEMENT_ACTIVATING),
tuple(BpmnElementType.PROCESS, ProcessInstanceIntent.ELEMENT_ACTIVATED),
Expand Down

0 comments on commit 9ebd9b5

Please sign in to comment.