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/05/26 19:46:44 UTC

[qpid-dispatch] branch master updated: DISPATCH-1664: Fix format specifier for policy count logs

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 cffcd1a  DISPATCH-1664: Fix format specifier for policy count logs
cffcd1a is described below

commit cffcd1aa838158c450b2129864d83486ec7e4533
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Tue May 26 15:45:46 2020 -0400

    DISPATCH-1664: Fix format specifier for policy count logs
    
    Add logging to failing self test to expose log lines of interest.
    
    This closes #745
---
 src/policy.c                 |  2 +-
 tests/system_tests_policy.py | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/policy.c b/src/policy.c
index 4444891..91166aa 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -315,7 +315,7 @@ void qd_policy_socket_close(qd_policy_t *policy, const qd_connection_t *conn)
         qd_policy_denial_counts_t *qpdc = conn->policy_settings->denialCounts;
         qd_log(policy->log_source, QD_LOG_DEBUG,
            "[C%"PRIu64"] Connection '%s' closed with resources n_sessions=%d, n_senders=%d, n_receivers=%d, "
-           "sessions_denied=%ld, senders_denied=%ld, receivers_denied=%ld, max_message_size_denied:%ld, nConnections= %ld.",
+           "sessions_denied=%"PRIu64", senders_denied=%"PRIu64", receivers_denied=%"PRIu64", max_message_size_denied:%"PRIu64", nConnections= %"PRIu64".",
             conn->connection_id, hostname, conn->n_sessions, conn->n_senders, conn->n_receivers,
             qpdc->sessionDenied, qpdc->senderDenied, qpdc->receiverDenied, qpdc->maxSizeMessagesDenied, n_connections);
     }
diff --git a/tests/system_tests_policy.py b/tests/system_tests_policy.py
index cf75634..9650b3e 100644
--- a/tests/system_tests_policy.py
+++ b/tests/system_tests_policy.py
@@ -28,6 +28,7 @@ import sys
 import time
 
 from system_test import TestCase, Qdrouterd, main_module, Process, TIMEOUT, DIR, TestTimeout
+from system_test import Logger
 from subprocess import PIPE, STDOUT
 from proton import ConnectionException, Timeout, Url, symbol
 from proton.handlers import MessagingHandler
@@ -344,6 +345,18 @@ class SenderReceiverLimits(TestCase):
             print("system_tests_policy, SenderReceiverLimits, test_verify_z_connection_stats: delay to wait for log to be written")
             sys.stdout.flush()
             time.sleep(1)
+        if not verified:
+            deny_lines = [s for s in log_lines if "DENY" in s]
+            resources_lines = [s for s in log_lines if "closed with resources" in s]
+            logger = Logger(title="Policy SenderReceiverLimits test_verify_z_connection_stats")
+            logger.log("Did not see log line containing: 'senders_denied=1, receivers_denied=1'")
+            logger.log("Policy DENY events")
+            for dl in deny_lines:
+                logger.log("  " + dl)
+            logger.log("Policy resources report")
+            for rl in resources_lines:
+                logger.log("  " + rl)
+            logger.dump()
         self.assertTrue(verified, msg='Policy did not log sender and receiver denials.')
 
 


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