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 2020/12/04 16:24:14 UTC

[qpid-dispatch] branch dev-protocol-adaptors-2 updated: DISPATCH-1846: Fix TCP adaptor test stall

This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch dev-protocol-adaptors-2
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/dev-protocol-adaptors-2 by this push:
     new b182b2e  DISPATCH-1846: Fix TCP adaptor test stall
b182b2e is described below

commit b182b2ea7ed571f5ec9f30bc3ab0a9d08f70af82
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Fri Dec 4 11:19:35 2020 -0500

    DISPATCH-1846: Fix TCP adaptor test stall
    
    * Wait until all echo server addresses are known to all interior routers.
    
    * Add 'ES_' prefix to echo server addresses.
      This prevents confusing echo server mobile address 'INTA' with
      router address 'INTA'. (Note that everything works without the
      prefix. For debugging the unique addresses are easier.)
    
    * Turn off echo server logging.
    
    This closes #934
---
 tests/TCP_echo_client.py          |  1 -
 tests/system_tests_tcp_adaptor.py | 36 ++++++++++++++++++++++++++++++++----
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/tests/TCP_echo_client.py b/tests/TCP_echo_client.py
index 56280aa..fe673b4 100755
--- a/tests/TCP_echo_client.py
+++ b/tests/TCP_echo_client.py
@@ -147,7 +147,6 @@ class TcpEchoClient:
                          selectors.EVENT_READ | selectors.EVENT_WRITE)
 
             # event loop
-            time.sleep(0.1)  # DISPATCH-1820 investigation
             while self.keep_running:
                 if self.timeout > 0.0:
                     elapsed = time.time() - start_time
diff --git a/tests/system_tests_tcp_adaptor.py b/tests/system_tests_tcp_adaptor.py
index 3c2b9c3..0f45987 100644
--- a/tests/system_tests_tcp_adaptor.py
+++ b/tests/system_tests_tcp_adaptor.py
@@ -35,6 +35,7 @@ from system_test import QdManager
 from system_test import unittest
 from system_test import DIR
 from system_test import SkipIfNeeded
+from system_test import Process
 from qpid_dispatch.management.client import Node
 from subprocess import PIPE, STDOUT
 
@@ -199,7 +200,7 @@ class TcpAdaptor(TestCase):
                                  'siteId': cls.site}),
                 ('tcpConnector', {'host': "127.0.0.1",
                                   'port': cls.tcp_server_listener_ports[name],
-                                  'address': name,
+                                  'address': 'ES_' + name,
                                   'siteId': cls.site})
             ]
             if connection:
@@ -208,7 +209,7 @@ class TcpAdaptor(TestCase):
             for rtr in cls.router_order:
                 listener = {'host': "0.0.0.0",
                             'port': cls.tcp_client_listener_ports[name][rtr],
-                            'address': rtr,
+                            'address': 'ES_' + rtr,
                             'siteId': cls.site}
                 tup = [(('tcpListener', listener))]
                 listeners.extend( tup )
@@ -356,14 +357,14 @@ class TcpAdaptor(TestCase):
         cls.INTC.wait_router_connected('INTB')
 
         # define logging levels
-        cls.print_logs_server = True
+        cls.print_logs_server = False
         cls.print_logs_client = True
 
         # start echo servers
         cls.echo_servers = {}
         for rtr in cls.router_order:
             test_name = "TcpAdaptor"
-            server_prefix = "ECHO_SERVER %s %s" % (test_name, rtr)
+            server_prefix = "ECHO_SERVER %s ES_%s" % (test_name, rtr)
             server_logger = Logger(title=test_name,
                                    print_to_console=cls.print_logs_server,
                                    save_for_dump=False,
@@ -375,6 +376,33 @@ class TcpAdaptor(TestCase):
             assert server.is_running
             cls.echo_servers[rtr] = server
 
+        # wait for server addresses (mobile ES_<rtr>) to propagate to all interior routers
+        interior_rtrs = [rtr for rtr in cls.router_order if rtr.startswith('I')]
+        found_all = False
+        while not found_all:
+            found_all = True
+            cls.logger.log("TCP_TEST Poll wait for echo server addresses to propagate")
+            for rtr in interior_rtrs:
+                # query each interior for addresses
+                p = Process(
+                    ['qdstat', '-b', str(cls.router_dict[rtr].addresses[0]), '-a'],
+                    name='qdstat-snap1', stdout=PIPE, expect=None,
+                    universal_newlines=True)
+                out = p.communicate()[0]
+                # examine what this router can see; signal poll loop to continue or not
+                lines = out.split("\n")
+                server_lines = [line for line in lines if "mobile" in line and "ES_" in line]
+                if not len(server_lines) == len(cls.router_order):
+                    found_all = False
+                    seen = []
+                    for line in server_lines:
+                        flds = line.split()
+                        seen.extend([fld for fld in flds if fld.startswith("ES_")])
+                    unseen = [srv for srv in cls.router_order if "ES_" + srv not in seen]
+                    cls.logger.log("TCP_TEST Router %s sees only %d of %d addresses. Waiting for %s" %
+                                   (rtr, len(server_lines), len(cls.router_order), unseen))
+        cls.logger.log("TCP_TEST Done poll wait")
+
     @classmethod
     def tearDownClass(cls):
         # stop echo servers


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org