Skip to content

Commit

Permalink
Fixes for intermittent FSM test failures (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaramallion authored Nov 9, 2023
1 parent 00e9b25 commit 929978b
Showing 1 changed file with 25 additions and 3 deletions.
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

0 comments on commit 929978b

Please sign in to comment.