-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(engine): turn off inconsistency detection test
- Loading branch information
1 parent
2a629db
commit 325c0c9
Showing
9 changed files
with
229 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 158 additions & 0 deletions
158
...a/io/zeebe/engine/processing/streamprocessor/ReprocessingIssueDetectionTurnedOffTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.0. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.0. | ||
*/ | ||
package io.zeebe.engine.processing.streamprocessor; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import io.zeebe.engine.util.EngineRule; | ||
import io.zeebe.engine.util.RecordToWrite; | ||
import io.zeebe.model.bpmn.Bpmn; | ||
import io.zeebe.protocol.record.Record; | ||
import io.zeebe.protocol.record.intent.JobIntent; | ||
import io.zeebe.protocol.record.intent.WorkflowInstanceIntent; | ||
import io.zeebe.protocol.record.value.BpmnElementType; | ||
import io.zeebe.protocol.record.value.JobRecordValue; | ||
import io.zeebe.protocol.record.value.WorkflowInstanceRecordValue; | ||
import io.zeebe.test.util.record.RecordingExporter; | ||
import io.zeebe.test.util.record.RecordingExporterTestWatcher; | ||
import io.zeebe.util.health.HealthStatus; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
public final class ReprocessingIssueDetectionTurnedOffTest { | ||
|
||
@Rule public final EngineRule engine = EngineRule.singlePartition(); | ||
|
||
@Rule | ||
public final RecordingExporterTestWatcher recordingExporterTestWatcher = | ||
new RecordingExporterTestWatcher(); | ||
|
||
private long workflowInstanceKey; | ||
private Record<JobRecordValue> jobCreated; | ||
private Record<WorkflowInstanceRecordValue> serviceTaskActivated; | ||
private Record<WorkflowInstanceRecordValue> processActivated; | ||
|
||
@Before | ||
public void setup() { | ||
engine | ||
.deployment() | ||
.withXmlResource( | ||
Bpmn.createExecutableProcess("process") | ||
.startEvent() | ||
.serviceTask("task", t -> t.zeebeJobType("test")) | ||
.done()) | ||
.deploy(); | ||
|
||
workflowInstanceKey = engine.workflowInstance().ofBpmnProcessId("process").create(); | ||
|
||
processActivated = | ||
RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED) | ||
.withElementType(BpmnElementType.PROCESS) | ||
.getFirst(); | ||
|
||
jobCreated = RecordingExporter.jobRecords(JobIntent.CREATED).getFirst(); | ||
|
||
serviceTaskActivated = | ||
RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED) | ||
.withElementType(BpmnElementType.SERVICE_TASK) | ||
.getFirst(); | ||
|
||
engine.stop(); | ||
} | ||
|
||
@Test | ||
public void shouldNotDetectDifferentKey() { | ||
// given | ||
engine.writeRecords( | ||
RecordToWrite.command() | ||
.job(JobIntent.COMPLETE, jobCreated.getValue()) | ||
.key(jobCreated.getKey()), | ||
RecordToWrite.event() | ||
.job(JobIntent.COMPLETED, jobCreated.getValue()) | ||
.key(jobCreated.getKey()) | ||
.causedBy(0), | ||
// expected the key to be serviceTaskActivated.getKey() | ||
RecordToWrite.event() | ||
.workflowInstance( | ||
WorkflowInstanceIntent.ELEMENT_COMPLETING, serviceTaskActivated.getValue()) | ||
.key(123L) | ||
.causedBy(1)); | ||
|
||
// when | ||
engine.start(); | ||
|
||
// then | ||
engine.awaitReprocessingCompleted(); | ||
|
||
final var streamProcessor = engine.getStreamProcessor(1); | ||
assertThat(streamProcessor.isFailed()).isFalse(); | ||
assertThat(streamProcessor.getHealthStatus()).isEqualTo(HealthStatus.HEALTHY); | ||
} | ||
|
||
@Test | ||
public void shouldNotDetectDifferentIntent() { | ||
// given | ||
engine.writeRecords( | ||
RecordToWrite.command() | ||
.job(JobIntent.COMPLETE, jobCreated.getValue()) | ||
.key(jobCreated.getKey()), | ||
RecordToWrite.event() | ||
.job(JobIntent.COMPLETED, jobCreated.getValue()) | ||
.key(jobCreated.getKey()) | ||
.causedBy(0), | ||
// expected the intent to be ELEMENT_COMPLETING | ||
RecordToWrite.event() | ||
.workflowInstance( | ||
WorkflowInstanceIntent.ELEMENT_TERMINATING, serviceTaskActivated.getValue()) | ||
.key(serviceTaskActivated.getKey()) | ||
.causedBy(1)); | ||
|
||
// when | ||
engine.start(); | ||
|
||
// then | ||
engine.awaitReprocessingCompleted(); | ||
|
||
final var streamProcessor = engine.getStreamProcessor(1); | ||
assertThat(streamProcessor.isFailed()).isFalse(); | ||
assertThat(streamProcessor.getHealthStatus()).isEqualTo(HealthStatus.HEALTHY); | ||
} | ||
|
||
@Test | ||
public void shouldNotDetectMissingRecordOnLogStream() { | ||
// given | ||
engine.writeRecords( | ||
RecordToWrite.command() | ||
.workflowInstance(WorkflowInstanceIntent.CANCEL, processActivated.getValue()) | ||
.key(workflowInstanceKey), | ||
RecordToWrite.event() | ||
.workflowInstance( | ||
WorkflowInstanceIntent.ELEMENT_TERMINATING, processActivated.getValue()) | ||
.key(workflowInstanceKey) | ||
.causedBy(0), | ||
// expected the follow-up event with intent ELEMENT_TERMINATING for the service task | ||
RecordToWrite.command() | ||
.job(JobIntent.COMPLETE, jobCreated.getValue()) | ||
.key(jobCreated.getKey()), | ||
RecordToWrite.event() | ||
.job(JobIntent.COMPLETED, jobCreated.getValue()) | ||
.key(jobCreated.getKey()) | ||
.causedBy(2)); | ||
|
||
// when | ||
engine.start(); | ||
|
||
// then | ||
engine.awaitReprocessingCompleted(); | ||
|
||
final var streamProcessor = engine.getStreamProcessor(1); | ||
assertThat(streamProcessor.isFailed()).isFalse(); | ||
assertThat(streamProcessor.getHealthStatus()).isEqualTo(HealthStatus.HEALTHY); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.