Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Fixes for intermittent FSM test failures #883

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions pynetdicom/tests/test_fsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def get_acceptor_assoc(self):
fsm = self.monkey_patch(assoc.dul.state_machine)
return assoc, fsm

def wait_on_state(self, fsm, state, timeout=2):
def wait_on_state(self, fsm, state, timeout=5):
start = 0
while (
fsm.current_state != state
Expand Down Expand Up @@ -2305,7 +2305,11 @@ def test_evt03(self):
# Sta5 + Evt3 -> AE-3 -> Sta6
# Evt3: Receive A-ASSOCIATE-AC PDU from <remote>
# AE-3: Issue A-ASSOCIATE (ac) primitive
commands = [("recv", None), ("send", a_associate_ac), ("exit", None)]
commands = [
("recv", None),
("send", a_associate_ac),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

Expand All @@ -2316,7 +2320,7 @@ def test_evt03(self):
assert self.fsm._changes[:3] == [
("Sta1", "Evt1", "AE-1"),
("Sta4", "Evt2", "AE-2"),
("Sta5", "Evt3", "AE-3"),
("Sta5", "Evt3", "AE-3"), # Sometimes not making it to Sta5...
]
assert self.fsm._transitions[:3] == ["Sta4", "Sta5", "Sta6"]
assert self.fsm._events[:3] == ["Evt1", "Evt2", "Evt3"]
Expand Down Expand Up @@ -3857,11 +3861,13 @@ def test_evt03(self):
("send", a_associate_ac),
("send", a_release_rq),
("send", a_associate_ac),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

scp.step()
scp.step()
scp.step()
scp.shutdown()
Expand All @@ -3886,11 +3892,13 @@ def test_evt04(self):
("send", a_associate_ac),
("send", a_release_rq),
("send", a_associate_rj),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

scp.step()
scp.step()
scp.step()
scp.shutdown()
Expand Down Expand Up @@ -3922,11 +3930,13 @@ def test_evt06(self):
("send", a_associate_ac),
("send", a_release_rq),
("send", a_associate_rq),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

scp.step()
scp.step()
scp.step()
scp.shutdown()
Expand Down Expand Up @@ -4012,13 +4022,15 @@ def test_evt09(self):
("recv", None),
("send", a_associate_ac),
("send", a_release_rq),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

self.assoc.dul.send_pdu(self.get_pdata())

scp.step()
scp.step()
scp.shutdown()

Expand All @@ -4041,11 +4053,13 @@ def test_evt10(self):
("send", a_associate_ac),
("send", a_release_rq),
("send", p_data_tf),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

scp.step()
scp.step()
scp.step()
scp.shutdown()
Expand Down Expand Up @@ -4101,11 +4115,13 @@ def test_evt12(self):
("send", a_associate_ac),
("send", a_release_rq),
("send", a_release_rq),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

scp.step()
scp.step()
scp.step()
scp.shutdown()
Expand All @@ -4130,11 +4146,13 @@ def test_evt13(self):
("send", a_associate_ac),
("send", a_release_rq),
("send", a_release_rp),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

scp.step()
scp.step()
scp.step()
scp.shutdown()
Expand All @@ -4158,13 +4176,15 @@ def test_evt14(self):
("recv", None),
("send", a_associate_ac),
("send", a_release_rq),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

self.assoc.dul.send_pdu(self.get_release(True))

scp.step()
scp.step()
scp.shutdown()

Expand Down Expand Up @@ -4308,11 +4328,13 @@ def test_evt19(self):
("send", a_associate_ac),
("send", a_release_rq),
("send", b"\x08\x00\x00\x00\x00\x00"),
("recv", None),
("exit", None),
]
self.scp = scp = self.start_server(commands)
self.move_to_state(self.assoc, scp)

scp.step()
scp.step()
scp.step()
scp.shutdown()
Expand Down
Loading