From df20c9ee751ca105b3a89a098520ce5a24fcf8e5 Mon Sep 17 00:00:00 2001 From: Remco Westerhoud Date: Mon, 8 May 2023 15:52:03 +0200 Subject: [PATCH] test(engine): fix flaky test 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. (cherry picked from commit cb26d2c2eeb684bfe53dfd4f1f9b513f289fbea8) --- .../EmbeddedSubProcessConcurrencyTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/engine/src/test/java/io/camunda/zeebe/engine/processing/bpmn/subprocess/EmbeddedSubProcessConcurrencyTest.java b/engine/src/test/java/io/camunda/zeebe/engine/processing/bpmn/subprocess/EmbeddedSubProcessConcurrencyTest.java index 45599173855f..4efe85d0537e 100644 --- a/engine/src/test/java/io/camunda/zeebe/engine/processing/bpmn/subprocess/EmbeddedSubProcessConcurrencyTest.java +++ b/engine/src/test/java/io/camunda/zeebe/engine/processing/bpmn/subprocess/EmbeddedSubProcessConcurrencyTest.java @@ -18,6 +18,7 @@ import io.camunda.zeebe.protocol.impl.record.value.message.MessageRecord; import io.camunda.zeebe.protocol.record.ValueType; 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.value.BpmnElementType; @@ -95,10 +96,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