Skip to content

Commit

Permalink
merge: #11052
Browse files Browse the repository at this point in the history
11052: [Backport stable/8.1] Resolve flaky timer test r=remcowesterhoud a=backport-action

# Description
Backport of #11033 to `stable/8.1`.

relates to #10272

Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
  • Loading branch information
zeebe-bors-camunda[bot] and remcowesterhoud committed Nov 18, 2022
2 parents f3dd3f6 + 9ebd9b5 commit 6314b42
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 6314b42

Please sign in to comment.