You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2019/11/01 16:00:51 UTC
[qpid-dispatch] branch master updated: DISPATCH-1465: Account for
log file write-read race before failing test
This is an automated email from the ASF dual-hosted git repository.
chug pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 23456f9 DISPATCH-1465: Account for log file write-read race before failing test
23456f9 is described below
commit 23456f9e42800c11f493e101eec3e7fcc933dc3a
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Fri Nov 1 11:56:42 2019 -0400
DISPATCH-1465: Account for log file write-read race before failing test
* Wait up to five seconds for a successful log file read to
verify that the policy event was written.
* Print a line when a wait was executed.
---
tests/system_tests_policy.py | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/tests/system_tests_policy.py b/tests/system_tests_policy.py
index e19d402..5dae1f6 100644
--- a/tests/system_tests_policy.py
+++ b/tests/system_tests_policy.py
@@ -24,6 +24,7 @@ from __future__ import print_function
import unittest as unittest
import os, json, re, signal
+import sys
import time
from system_test import TestCase, Qdrouterd, main_module, Process, TIMEOUT, DIR
@@ -327,10 +328,23 @@ class SenderReceiverLimits(TestCase):
bs1.close()
def test_verify_z_connection_stats(self):
- with open('../setUpClass/SenderReceiverLimits.log', 'r') as router_log:
- log_lines = router_log.read().split("\n")
- close_lines = [s for s in log_lines if "senders_denied=1, receivers_denied=1" in s]
- self.assertTrue(len(close_lines) == 1, msg='Policy did not log sender and receiver denials.')
+ # This test relies on being executed after test_verify_n_receivers and test_verify_n_senders.
+ # This test is named to follow those tests alphabetically.
+ # It also relies on executing after the router log file has written the policy logs.
+ # In some emulated environments the router log file writes may lag test execution.
+ # To accomodate the file lag this test may retry reading the log file.
+ verified = False
+ for tries in range(5):
+ with open('../setUpClass/SenderReceiverLimits.log', 'r') as router_log:
+ log_lines = router_log.read().split("\n")
+ close_lines = [s for s in log_lines if "senders_denied=1, receivers_denied=1" in s]
+ verified = len(close_lines) == 1
+ if verified:
+ break;
+ print("system_tests_policy, SenderReceiverLimits, test_verify_z_connection_stats: delay to wait for log to be written")
+ sys.stdout.flush()
+ time.sleep(1)
+ self.assertTrue(verified, msg='Policy did not log sender and receiver denials.')
class PolicyVhostOverride(TestCase):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org