only create the force run event if the instance was actually forced to run w/ burnettk (#1713)
Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
parent
c674f0c157
commit
7536bc3716
|
@ -670,7 +670,8 @@ def _process_instance_run(
|
||||||
|
|
||||||
processor = None
|
processor = None
|
||||||
try:
|
try:
|
||||||
ProcessInstanceTmpService.add_event_to_process_instance(process_instance, "process_instance_force_run")
|
if force_run is True:
|
||||||
|
ProcessInstanceTmpService.add_event_to_process_instance(process_instance, "process_instance_force_run")
|
||||||
if not queue_process_instance_if_appropriate(
|
if not queue_process_instance_if_appropriate(
|
||||||
process_instance, execution_mode=execution_mode
|
process_instance, execution_mode=execution_mode
|
||||||
) and not ProcessInstanceTmpService.is_enqueued_to_run_in_the_future(process_instance):
|
) and not ProcessInstanceTmpService.is_enqueued_to_run_in_the_future(process_instance):
|
||||||
|
|
|
@ -1150,6 +1150,49 @@ class TestProcessApi(BaseTest):
|
||||||
assert response.json["status"] == "complete"
|
assert response.json["status"] == "complete"
|
||||||
assert response.json["process_model_identifier"] == process_model.id
|
assert response.json["process_model_identifier"] == process_model.id
|
||||||
|
|
||||||
|
event_count = ProcessInstanceEventModel.query.filter_by(
|
||||||
|
process_instance_id=process_instance_id, event_type=ProcessInstanceEventType.process_instance_force_run.value
|
||||||
|
).count()
|
||||||
|
assert event_count == 0
|
||||||
|
|
||||||
|
def test_process_instance_run_with_force(
|
||||||
|
self,
|
||||||
|
app: Flask,
|
||||||
|
client: FlaskClient,
|
||||||
|
with_db_and_bpmn_file_cleanup: None,
|
||||||
|
with_super_admin_user: UserModel,
|
||||||
|
) -> None:
|
||||||
|
# process_model_id = "runs_without_input/sample"
|
||||||
|
process_model = self.create_group_and_model_with_bpmn(
|
||||||
|
client=client,
|
||||||
|
user=with_super_admin_user,
|
||||||
|
process_group_id="runs_without_input",
|
||||||
|
process_model_id="sample",
|
||||||
|
bpmn_file_name=None,
|
||||||
|
bpmn_file_location="sample",
|
||||||
|
)
|
||||||
|
|
||||||
|
headers = self.logged_in_headers(with_super_admin_user)
|
||||||
|
response = self.create_process_instance_from_process_model_id_with_api(client, process_model.id, headers)
|
||||||
|
assert response.json is not None
|
||||||
|
process_instance_id = response.json["id"]
|
||||||
|
response = client.post(
|
||||||
|
f"/v1.0/process-instances/{self.modify_process_identifier_for_path_param(process_model.id)}/{process_instance_id}/run?force_run=true",
|
||||||
|
headers=self.logged_in_headers(with_super_admin_user),
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.json is not None
|
||||||
|
assert isinstance(response.json["updated_at_in_seconds"], int)
|
||||||
|
assert response.json["updated_at_in_seconds"] > 0
|
||||||
|
assert response.json["status"] == "complete"
|
||||||
|
assert response.json["process_model_identifier"] == process_model.id
|
||||||
|
|
||||||
|
event_count = ProcessInstanceEventModel.query.filter_by(
|
||||||
|
process_instance_id=process_instance_id, event_type=ProcessInstanceEventType.process_instance_force_run.value
|
||||||
|
).count()
|
||||||
|
assert event_count == 1
|
||||||
|
|
||||||
def test_process_instance_run_with_instructions(
|
def test_process_instance_run_with_instructions(
|
||||||
self,
|
self,
|
||||||
app: Flask,
|
app: Flask,
|
||||||
|
|
Loading…
Reference in New Issue