From 8d37e0a4905eba80e07345d5ac048b7e2ae5a13f Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Tue, 26 Apr 2022 21:50:04 -0400 Subject: [PATCH] Made the stuck-delivery test less flakey. --- tests/system_tests_stuck_deliveries.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/system_tests_stuck_deliveries.py b/tests/system_tests_stuck_deliveries.py index 1e7c9f9a5..287cc610f 100644 --- a/tests/system_tests_stuck_deliveries.py +++ b/tests/system_tests_stuck_deliveries.py @@ -267,6 +267,7 @@ def __init__(self, host): self.addr = "rx/link/credit/test" self.credit_issued = 0 self.error = None + self.get_baseline = True self.stages = ['Setup', 'LinkBlocked', 'LinkUnblocked', '10Credits', '20Credits'] self.stage = 0 @@ -342,7 +343,10 @@ def on_message(self, event): # # LinkBlocked # - if response.results[0].linksBlocked == 1: + if self.get_baseline: + self.get_baseline = False + self.baseline_blocked = response.results[0].linksBlocked + if response.results[0].linksBlocked == self.baseline_blocked + 1: self.receiver.flow(10) self.stage = 2 self.process() @@ -352,7 +356,7 @@ def on_message(self, event): # # LinkUnblocked # - if response.results[0].linksBlocked == 0: + if response.results[0].linksBlocked == self.baseline_blocked: self.stage = 3 self.process() return @@ -398,6 +402,7 @@ def __init__(self, host): self.addr = "rx/link/credit/test" self.credit_issued = 0 self.error = None + self.get_baseline = True self.stages = ['Setup', 'LinkBlocked', 'LinkUnblocked', '250Credits'] self.stage = 0 @@ -465,7 +470,10 @@ def on_message(self, event): # # LinkBlocked # - if response.results[0].linksBlocked == 1: + if self.get_baseline: + self.get_baseline = False + self.baseline_blocked = response.results[0].linksBlocked + if response.results[0].linksBlocked == self.baseline_blocked + 1: self.receiver = event.container.create_receiver(self.sender_conn, self.addr) self.stage = 2 self.process() @@ -475,7 +483,7 @@ def on_message(self, event): # # LinkUnblocked # - if response.results[0].linksBlocked == 0: + if response.results[0].linksBlocked == self.baseline_blocked: self.stage = 3 self.process() return