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/22 18:01:31 UTC

[qpid-dispatch] branch master updated: DISPATCH-1493: Addresses with no priority better handled by qdstat

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 a99156b  DISPATCH-1493: Addresses with no priority better handled by qdstat
a99156b is described below

commit a99156b54071b082866759ba58cf9c2a96a35973
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Fri Nov 22 11:51:44 2019 -0500

    DISPATCH-1493: Addresses with no priority better handled by qdstat
    
     * Display a hyphen instead of blank string in priority column
     * Fix test to allow the hyphen and to test for negative numbers
     * Fix regex in link priority to allow negative numbers
---
 tests/system_tests_qdstat.py | 21 +++++++++++++--------
 tools/qdstat.in              |  2 +-
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/tests/system_tests_qdstat.py b/tests/system_tests_qdstat.py
index d3ec87d..ed4ee87 100644
--- a/tests/system_tests_qdstat.py
+++ b/tests/system_tests_qdstat.py
@@ -125,13 +125,17 @@ class QdstatTest(system_test.TestCase):
 
         # extract the number in the priority column of every address
         for i in range(6, len(lines) - 1):
-            pri = re.findall('\d+', lines[i][priority_column:])
-            # make sure the priority found is a number
-            self.assertTrue(len(pri) > 0, "Can not find numeric priority in '%s'" % lines[i])
-            priority = int(pri[0])
-            # make sure the priority is from -1 to 9
-            self.assertTrue(priority >= -1, "Priority was less than -1")
-            self.assertTrue(priority <= 9, "Priority was greater than 9")
+            pri = re.findall(r'[-\d]+', lines[i][priority_column:])
+
+            # make sure the priority found is a hyphen or a legal number
+            if pri[0] == '-':
+                pass # naked hypnen is allowed
+            else:
+                self.assertTrue(len(pri) > 0, "Can not find numeric priority in '%s'" % lines[i])
+                priority = int(pri[0])
+                # make sure the priority is from -1 to 9
+                self.assertTrue(priority >= -1, "Priority was less than -1")
+                self.assertTrue(priority <= 9, "Priority was greater than 9")
 
     def test_address_with_limit(self):
         out = self.run_qdstat(['--address', '--limit=1'])
@@ -338,9 +342,10 @@ class QdstatLinkPriorityTest(system_test.TestCase):
         priorities = {}
         for i in range(6, len(lines) - 1):
             if re.search(r'inter-router', lines[i]):
-                pri = re.findall('\d+', lines[i][priority_column:])
+                pri = re.findall(r'[-\d]+', lines[i][priority_column:])
                 # make sure the priority found is a number
                 self.assertTrue(len(pri) > 0, "Can not find numeric priority in '%s'" % lines[i])
+                self.assertTrue(pri[0] != '-') # naked hypen disallowed
                 priority = int(pri[0])
                 # make sure the priority is from 0 to 9
                 self.assertTrue(priority >= 0, "Priority was less than 0")
diff --git a/tools/qdstat.in b/tools/qdstat.in
index e9bd2f5..d4b52b3 100755
--- a/tools/qdstat.in
+++ b/tools/qdstat.in
@@ -580,7 +580,7 @@ class BusManager(Node):
             row.append(self._addr_phase(addr.name))
             row.append(addr.distribution)
             if has_priority:
-                row.append(addr.priority if addr.priority >= 0 else "")
+                row.append(addr.priority if addr.priority >= 0 else "-")
             if self.opts.verbose:
                 row.append(addr.inProcess)
             row.append(addr.containerCount if addr.name[0] in 'CDEF' else addr.subscriberCount)


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