This commit is contained in:
Dan 2023-02-27 14:21:22 -05:00
parent f65ed14df3
commit 6401481f99
1 changed files with 33 additions and 20 deletions

View File

@ -129,8 +129,7 @@ class TestMessageService(BaseTest):
MessageInstanceModel.query.filter_by(message_type="receive") MessageInstanceModel.query.filter_by(message_type="receive")
.filter_by(status="ready") .filter_by(status="ready")
.filter_by(process_instance_id=self.process_instance.id) .filter_by(process_instance_id=self.process_instance.id)
.order_by( .order_by(MessageInstanceModel.id)
MessageInstanceModel.id)
.all() .all()
) )
assert len(waiting_messages) == 0 assert len(waiting_messages) == 0
@ -143,11 +142,13 @@ class TestMessageService(BaseTest):
assert self.process_instance.status == "complete" assert self.process_instance.status == "complete"
# The message receiver process is also complete # The message receiver process is also complete
message_receiver_process = ProcessInstanceModel.query.filter_by( message_receiver_process = (
process_model_identifier="test_group/message_receive" ProcessInstanceModel.query.filter_by(
).order_by( process_model_identifier="test_group/message_receive"
MessageInstanceModel.id )
).first() .order_by(ProcessInstanceModel.id)
.first()
)
assert message_receiver_process.status == "complete" assert message_receiver_process.status == "complete"
def start_sender_process( def start_sender_process(
@ -291,13 +292,21 @@ class TestMessageService(BaseTest):
process_instance_result = ProcessInstanceModel.query.all() process_instance_result = ProcessInstanceModel.query.all()
assert len(process_instance_result) == 3 assert len(process_instance_result) == 3
process_instance_receiver_one = ProcessInstanceModel.query.filter_by( process_instance_receiver_one = (
process_model_identifier="test_group/message_receiver_one" ProcessInstanceModel.query.filter_by(
).order_by(MessageInstanceModel.id).first() process_model_identifier="test_group/message_receiver_one"
)
.order_by(ProcessInstanceModel.id)
.first()
)
assert process_instance_receiver_one is not None assert process_instance_receiver_one is not None
process_instance_receiver_two = ProcessInstanceModel.query.filter_by( process_instance_receiver_two = (
process_model_identifier="test_group/message_receiver_two" ProcessInstanceModel.query.filter_by(
).order_by(MessageInstanceModel.id).first() process_model_identifier="test_group/message_receiver_two"
)
.order_by(ProcessInstanceModel.id)
.first()
)
assert process_instance_receiver_two is not None assert process_instance_receiver_two is not None
# just make sure it's a different process instance # just make sure it's a different process instance
@ -314,9 +323,11 @@ class TestMessageService(BaseTest):
assert process_instance_receiver_two.id != process_instance_sender.id assert process_instance_receiver_two.id != process_instance_sender.id
assert process_instance_receiver_two.status == "complete" assert process_instance_receiver_two.status == "complete"
message_instance_result = MessageInstanceModel.query.order_by( message_instance_result = (
MessageInstanceModel.id MessageInstanceModel.query.order_by(MessageInstanceModel.id)
).order_by(MessageInstanceModel.id).all() .order_by(MessageInstanceModel.id)
.all()
)
assert len(message_instance_result) == 7 assert len(message_instance_result) == 7
message_instance_receiver_one = [ message_instance_receiver_one = [
@ -338,15 +349,17 @@ class TestMessageService(BaseTest):
# more messages that need to be picked up. # more messages that need to be picked up.
MessageService.correlate_all_message_instances() MessageService.correlate_all_message_instances()
message_instance_result = MessageInstanceModel.query.order_by( message_instance_result = (
MessageInstanceModel.id MessageInstanceModel.query.order_by(MessageInstanceModel.id)
).order_by(MessageInstanceModel.id).all() .order_by(MessageInstanceModel.id)
.all()
)
assert len(message_instance_result) == 8 assert len(message_instance_result) == 8
for message_instance in message_instance_result: for message_instance in message_instance_result:
assert message_instance.status == "completed" assert message_instance.status == "completed"
process_instance_result = ProcessInstanceModel.query.order_by( process_instance_result = ProcessInstanceModel.query.order_by(
MessageInstanceModel.id ProcessInstanceModel.id
).all() ).all()
assert len(process_instance_result) == 3 assert len(process_instance_result) == 3
for process_instance in process_instance_result: for process_instance in process_instance_result: