Skip to content

Commit

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

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

relates to #10272

Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
  • Loading branch information
zeebe-bors-camunda[bot] and remcowesterhoud committed Nov 22, 2022
2 parents 6980ce4 + 641fd64 commit 27fd39a
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 27fd39a

Please sign in to comment.