Skip to content

Commit

Permalink
merge: #8682
Browse files Browse the repository at this point in the history
8682: [Backport stable/1.3] Let `WorkloadGenerator` wait longer for created incident r=npepinpe a=oleschoenburg

Manual backport of #8650 

Co-authored-by: Ole Schönburg <[email protected]>
  • Loading branch information
zeebe-bors-cloud[bot] and lenaschoenburg authored Jan 28, 2022
2 parents f7a3116 + ed4f500 commit 227777c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
6 changes: 6 additions & 0 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@
<artifactId>agrona</artifactId>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package io.camunda.zeebe.test.exporter;

import static io.camunda.zeebe.test.EmbeddedBrokerRule.TEST_RECORD_EXPORTER_ID;
import static io.camunda.zeebe.test.util.record.RecordingExporter.processInstanceRecords;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -27,7 +26,6 @@
import io.camunda.zeebe.test.ClientRule;
import io.camunda.zeebe.test.EmbeddedBrokerRule;
import io.camunda.zeebe.test.util.TestConfigurationFactory;
import io.camunda.zeebe.test.util.TestUtil;
import io.camunda.zeebe.test.util.record.RecordingExporter;
import io.camunda.zeebe.test.util.record.RecordingExporterTestWatcher;
import io.netty.util.NetUtil;
Expand All @@ -43,6 +41,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.awaitility.Awaitility;
import org.junit.rules.ExternalResource;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
Expand Down Expand Up @@ -298,10 +297,16 @@ public void performSampleWorkload() {

// wait for incident and resolve it
final Record<IncidentRecordValue> incident =
RecordingExporter.incidentRecords(IncidentIntent.CREATED)
.withProcessInstanceKey(processInstanceKey)
.withElementId("task")
.getFirst();
Awaitility.await("the incident was created")
.timeout(Duration.ofMinutes(1))
.until(
() ->
RecordingExporter.incidentRecords(IncidentIntent.CREATED)
.withProcessInstanceKey(processInstanceKey)
.withElementId("task")
.findFirst(),
Optional::isPresent)
.orElseThrow();
clientRule
.getClient()
.newUpdateRetriesCommand(incident.getValue().getJobKey())
Expand Down Expand Up @@ -389,11 +394,12 @@ public void publishMessage(final String messageName, final String correlationKey
* @param processInstanceKey ID of the process
*/
public void awaitProcessCompletion(final long processInstanceKey) {
TestUtil.waitUntil(
() ->
processInstanceRecords(ProcessInstanceIntent.ELEMENT_COMPLETED)
.filter(r -> r.getKey() == processInstanceKey)
.exists());
Awaitility.await("the process instance was completed")
.until(
() ->
RecordingExporter.processInstanceRecords(ProcessInstanceIntent.ELEMENT_COMPLETED)
.filter(r -> r.getKey() == processInstanceKey)
.exists());
}

private Properties newClientProperties() {
Expand Down

0 comments on commit 227777c

Please sign in to comment.