diff options
| author | Charles E. Rolke <chug@apache.org> | 2013-02-12 20:58:45 +0000 |
|---|---|---|
| committer | Charles E. Rolke <chug@apache.org> | 2013-02-12 20:58:45 +0000 |
| commit | 9ecd81538a702428d631cb3ec65076a59f16132f (patch) | |
| tree | aa242ecb0d7a520f8f6948f9c0bf9d54e2c5449b /qpid/cpp/src/tests | |
| parent | 47ad697c8cbd54cdfa126b8f980578a873dfd028 (diff) | |
| download | qpid-python-9ecd81538a702428d631cb3ec65076a59f16132f.tar.gz | |
QPID-4054: C++ Broker connection limits specified per-user
From the self-test log file:
2013-02-12 15:33:53 [Broker] notice Changing log hires timestamp to 1
2013-02-12 15:33:53.219003940 [Broker] debug Broker::setLogHiresTimestamp()
...
2013-02-12 15:33:53.491318800 [Broker] notice Changing log hires timestamp to 0
2013-02-12 15:33:53 [Broker] debug Broker::setLogHiresTimestamp()
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1445358 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests')
| -rw-r--r-- | qpid/cpp/src/tests/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/Makefile.am | 3 | ||||
| -rwxr-xr-x | qpid/cpp/src/tests/dynamic_log_hires_timestamp | 75 |
3 files changed, 78 insertions, 1 deletions
diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt index bc13e2ecdd..7f122891d0 100644 --- a/qpid/cpp/src/tests/CMakeLists.txt +++ b/qpid/cpp/src/tests/CMakeLists.txt @@ -319,6 +319,7 @@ if (BUILD_ACL) add_test (acl_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_acl_tests${test_script_suffix}) endif (BUILD_ACL) add_test (dynamic_log_level_test ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_log_level_test${test_script_suffix}) +add_test (dynamic_log_hires_timestamp ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/dynamic_log_hires_timestamp${test_script_suffix}) if (BUILD_MSSQL) add_test (store_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_store_tests${test_script_suffix} MSSQL) endif (BUILD_MSSQL) diff --git a/qpid/cpp/src/tests/Makefile.am b/qpid/cpp/src/tests/Makefile.am index d035e1aaa8..3513e0a6d6 100644 --- a/qpid/cpp/src/tests/Makefile.am +++ b/qpid/cpp/src/tests/Makefile.am @@ -298,7 +298,7 @@ system_tests = qpid-client-test quick_perftest quick_topictest run_header_test q TESTS += start_broker $(system_tests) python_tests stop_broker \ run_ha_tests run_federation_tests run_federation_sys_tests \ run_acl_tests run_cli_tests dynamic_log_level_test \ - run_queue_flow_limit_tests ipv6_test + dynamic_log_hires_timestamp run_queue_flow_limit_tests ipv6_test EXTRA_DIST += \ run_test vg_check \ @@ -325,6 +325,7 @@ EXTRA_DIST += \ ring_queue_test \ run_ring_queue_test \ dynamic_log_level_test \ + dynamic_log_hires_timestamp \ qpid-ctrl \ CMakeLists.txt \ windows/DisableWin32ErrorWindows.cpp \ diff --git a/qpid/cpp/src/tests/dynamic_log_hires_timestamp b/qpid/cpp/src/tests/dynamic_log_hires_timestamp new file mode 100755 index 0000000000..afe79cc9b3 --- /dev/null +++ b/qpid/cpp/src/tests/dynamic_log_hires_timestamp @@ -0,0 +1,75 @@ +#!/bin/bash + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Run a simple test to verify dynamic log highres timestamp changes +source ./test_env.sh +test -d $PYTHON_DIR || { echo "Skipping python tests, no python dir."; exit 0; } + +LOG_FILE=hires_test.log +trap cleanup EXIT + +cleanup() { + test -n "$PORT" && $QPIDD_EXEC --no-module-dir --quit --port $PORT +} + +error() { + echo $*; + exit 1; +} + +rm -rf $LOG_FILE +PORT=$($QPIDD_EXEC --auth=no --no-module-dir --daemon --port=0 --log-to-file $LOG_FILE) || error "Could not start broker" + +echo Broker for log highres timestamp test started on $PORT, pid is $($QPIDD_EXEC --no-module-dir --check --port $PORT) + +$srcdir/qpid-ctrl -b localhost:$PORT setLogLevel level='debug+:Broker' > /dev/null +$srcdir/qpid-ctrl -b localhost:$PORT echo sequence=1 body=LOWRES > /dev/null +$srcdir/qpid-ctrl -b localhost:$PORT setLogHiresTimestamp logHires='true' > /dev/null +$srcdir/qpid-ctrl -b localhost:$PORT echo sequence=2 body=HI_RES > /dev/null +$srcdir/qpid-ctrl -b localhost:$PORT setLogHiresTimestamp logHires='false' > /dev/null +$srcdir/qpid-ctrl -b localhost:$PORT echo sequence=3 body=LOWRES > /dev/null + +# Expect 3 log entries with 'echo' in them +if [[ $(grep echo $LOG_FILE | wc -l) -ne 3 ]]; then + cat $LOG_FILE + error "Log content error - expected 3 echo log entries" +fi + +# Lines 1 and 3 are length X +# Line 2 is length X+10 because of timestamp addition +LEN1=$(grep echo $LOG_FILE | grep \(1 | wc -m) +LEN2=$(grep echo $LOG_FILE | grep \(2 | wc -m) +LEN3=$(grep echo $LOG_FILE | grep \(3 | wc -m) +EXPECTED_LEN2=$(( $LEN1 + 10 )) + +if [ $LEN1 -ne $LEN3 ]; then + cat $LOG_FILE + error "Log content error - expected echo 3 to be same line length as echo 1" +fi + +if [ $LEN2 -ne $EXPECTED_LEN2 ]; then + cat $LOG_FILE + error "Log content error - expected echo 2 to be 10 characters longer than echo 1" +fi + +rm -rf $LOG_FILE +echo OK + |
