Skip to content

Commit

Permalink
test(engine): fix flaky test
Browse files Browse the repository at this point in the history
The test was flaky because it could occur that the messages got published before the subscription were opened.
As the messages have no TTL this means they were not getting correlated, as expected.
  • Loading branch information
remcowesterhoud committed May 9, 2023
1 parent 27afb54 commit 303e38e
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.camunda.zeebe.protocol.record.ValueType;
import io.camunda.zeebe.protocol.record.intent.JobIntent;
import io.camunda.zeebe.protocol.record.intent.MessageIntent;
import io.camunda.zeebe.protocol.record.intent.MessageSubscriptionIntent;
import io.camunda.zeebe.protocol.record.intent.ProcessEventIntent;
import io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent;
import io.camunda.zeebe.protocol.record.intent.VariableIntent;
Expand Down Expand Up @@ -623,10 +624,15 @@ public void shouldNotTriggerBoundaryEventWhenFlowscopeIsInterrupted() {
.withVariable("correlationKey", "correlationKey")
.create();

RecordingExporter.processInstanceRecords(ProcessInstanceIntent.ELEMENT_ACTIVATED)
.withProcessInstanceKey(processInstanceKey)
.withElementId("task")
.await();
assertThat(
RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.CREATED)
.withProcessInstanceKey(processInstanceKey)
.limit(2))
.describedAs(
"The 2 message subscriptions must be created before we publish the "
+ "messages. As the messages have a TTL of 0 seconds")
.describedAs("")
.hasSize(2);

// when
// We need to make sure no records are written in between the publish commands. This could
Expand Down

0 comments on commit 303e38e

Please sign in to comment.