Skip to content

Commit

Permalink
test: ensure that the problem is resolved
Browse files Browse the repository at this point in the history
When resolving an incident, the incident is almost always marked as
resolved. Even when new incidents pop up after. We should therefore
verify that the problem is gone, not just that the incident is resolved.
  • Loading branch information
korthout committed Jun 11, 2024
1 parent 9a08974 commit 09a494c
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@

import static io.camunda.zeebe.engine.processing.processinstance.migration.MigrationTestUtil.extractProcessDefinitionKeyByProcessId;
import static io.camunda.zeebe.protocol.record.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import io.camunda.zeebe.engine.util.EngineRule;
import io.camunda.zeebe.model.bpmn.Bpmn;
import io.camunda.zeebe.protocol.record.Record;
import io.camunda.zeebe.protocol.record.intent.IncidentIntent;
import io.camunda.zeebe.protocol.record.intent.JobIntent;
import io.camunda.zeebe.protocol.record.value.IncidentRecordValue;
import io.camunda.zeebe.test.util.BrokerClassRuleHelper;
import io.camunda.zeebe.test.util.record.RecordingExporter;
Expand Down Expand Up @@ -80,7 +82,6 @@ public void shouldResolveIncidentAfterMigratingActivatingElementWithMessageBound
final long targetProcessDefinitionKey =
extractProcessDefinitionKeyByProcessId(deployment, targetProcessId);

// when
ENGINE
.processInstance()
.withInstanceKey(processInstanceKey)
Expand All @@ -89,14 +90,15 @@ public void shouldResolveIncidentAfterMigratingActivatingElementWithMessageBound
.addMappingInstruction("A", "B")
.migrate();

// then
final Record<IncidentRecordValue> incidentRecord =
ENGINE.incident().ofInstance(processInstanceKey).withKey(incident.getKey()).resolve();
// when
ENGINE.incident().ofInstance(processInstanceKey).withKey(incident.getKey()).resolve();

assertThat(incidentRecord.getValue())
.describedAs("Expect that the incident resolved event contains updated fields")
.hasProcessDefinitionKey(targetProcessDefinitionKey)
.hasBpmnProcessId(targetProcessId)
.hasElementId("B");
// then
assertThat(
RecordingExporter.jobRecords(JobIntent.CREATED)
.withProcessInstanceKey(processInstanceKey)
.exists())
.describedAs("Expect that the problem was resolved, so we could create the job")
.isTrue();
}
}

0 comments on commit 09a494c

Please sign in to comment.