diff options
Diffstat (limited to 'cpp/src')
24 files changed, 105 insertions, 58 deletions
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am index 7a08a6d10b..66d2cdd5d5 100644 --- a/cpp/src/tests/Makefile.am +++ b/cpp/src/tests/Makefile.am @@ -320,7 +320,7 @@ EXTRA_DIST += \ header_test.py \ ssl_test \ config.null \ - ais_check \ + cpg_check.sh.in \ run_federation_tests \ run_federation_sys_tests \ run_long_federation_sys_tests \ @@ -368,9 +368,15 @@ LONG_TESTS+=start_broker \ fanout_perftest shared_perftest multiq_perftest topic_perftest run_ring_queue_test \ run_msg_group_tests_soak \ stop_broker \ - run_long_federation_sys_tests \ - run_failover_soak reliable_replication_test \ - federated_cluster_test_with_node_failure + run_long_federation_sys_tests + +if HAVE_LIBCPG + +LONG_TESTS+= federated_cluster_test_with_node_failure \ + run_failover_soak \ + reliable_replication_test + +endif HAVE_LIBCPG EXTRA_DIST+= \ fanout_perftest \ @@ -381,7 +387,8 @@ EXTRA_DIST+= \ reliable_replication_test \ federated_cluster_test_with_node_failure \ sasl_test_setup.sh \ - run_msg_group_tests_soak + run_msg_group_tests_soak \ + qpidd-empty.conf check-long: $(MAKE) check TESTS="$(LONG_TESTS)" VALGRIND= diff --git a/cpp/src/tests/cluster.cmake b/cpp/src/tests/cluster.cmake index 3471173e97..31e2d337d1 100644 --- a/cpp/src/tests/cluster.cmake +++ b/cpp/src/tests/cluster.cmake @@ -55,7 +55,7 @@ add_test (clustered_replication_test ${CMAKE_CURRENT_SOURCE_DIR}/clustered_repli # CLEANFILES += cluster_test.acl cluster.ports # EXTRA_DIST += \ -# ais_check \ +# cpg_check.sh.in \ # run_cluster_test \ # cluster_read_credit \ # test_watchdog \ diff --git a/cpp/src/tests/cluster.mk b/cpp/src/tests/cluster.mk index df24f021ba..852b2dda8c 100644 --- a/cpp/src/tests/cluster.mk +++ b/cpp/src/tests/cluster.mk @@ -29,7 +29,7 @@ CLUSTER_TEST_SCRIPTS_LIST= \ EXTRA_DIST += \ $(CLUSTER_TEST_SCRIPTS_LIST) \ - ais_check \ + cpg_check.sh.in \ run_cluster_test \ cluster_read_credit \ test_watchdog \ @@ -54,14 +54,12 @@ if HAVE_LIBCPG # # Cluster tests makefile fragment, to be included in Makefile.am -# +# # NOTE: Programs using the openais library must be run with gid=ais # You should do "newgrp ais" before running the tests to run these. -# - +# -# ais_check checks pre-requisites for cluster tests and runs them if ok. TESTS += \ run_cluster_test \ cluster_read_credit \ diff --git a/cpp/src/tests/cluster_python_tests b/cpp/src/tests/cluster_python_tests index 8e17ffc8bc..25c7889246 100755 --- a/cpp/src/tests/cluster_python_tests +++ b/cpp/src/tests/cluster_python_tests @@ -20,7 +20,8 @@ # # Skip if cluster services not running. -. `dirname $0`/ais_check +. cpg_check.sh +cpg_enabled || exit 0 FAILING=`dirname $0`/cluster_python_tests_failing.txt source `dirname $0`/python_tests diff --git a/cpp/src/tests/cluster_read_credit b/cpp/src/tests/cluster_read_credit index fb3b72fbaf..552ffee53b 100755 --- a/cpp/src/tests/cluster_read_credit +++ b/cpp/src/tests/cluster_read_credit @@ -21,7 +21,9 @@ # Regression test for http://issues.apache.org/jira/browse/QPID-2086 srcdir=`dirname $0` -. $srcdir/ais_check +source cpg_check.sh +cpg_enabled || exit 0 + $srcdir/start_cluster 1 --cluster-read-max=2 || exit 1 trap $srcdir/stop_cluster EXIT seq 1 10000 | ./sender --port `cat cluster.ports` --routing-key no-such-queue diff --git a/cpp/src/tests/clustered_replication_test b/cpp/src/tests/clustered_replication_test index 8c8522c2eb..5a9f143eb4 100755 --- a/cpp/src/tests/clustered_replication_test +++ b/cpp/src/tests/clustered_replication_test @@ -8,9 +8,9 @@ # 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 @@ -34,11 +34,11 @@ stop_brokers() { if [[ $PRIMARY1 ]] ; then $QPIDD_EXEC --no-module-dir -q --port $PRIMARY1 unset PRIMARY1 - fi + fi if [[ $PRIMARY2 ]] ; then $QPIDD_EXEC --no-module-dir -q --port $PRIMARY2 unset PRIMARY2 - fi + fi if [[ $DR1 ]] ; then $QPIDD_EXEC --no-module-dir -q --port $DR1 unset DR1 @@ -50,7 +50,8 @@ stop_brokers() { } if test -d $PYTHON_DIR; then - . $srcdir/ais_check + . cpg_check.sh + cpg_enabled || exit 0 #todo: these cluster names need to be unique to prevent clashes PRIMARY_CLUSTER=PRIMARY_$(hostname)_$$ @@ -89,20 +90,20 @@ if test -d $PYTHON_DIR; then #send more messages to primary for i in `seq 11 20`; do echo Message$i; done | ./sender --port $PRIMARY1 --send-eos 1 - #wait for replication events to all be processed: + #wait for replication events to all be processed: echo Waiting for replication to complete echo Done | ./sender --port $PRIMARY1 --routing-key control-queue --send-eos 1 ./receiver --queue control-queue --port $DR1 > /dev/null #verify contents of test queue on dr cluster: - echo Verifying... + echo Verifying... ./receiver --port $DR2 > repl.out.tmp for i in `seq 6 20`; do echo Message$i; done | diff repl.out.tmp - || FAIL=1 if [[ $FAIL ]]; then echo Clustered replication test failed: expectations not met! exit 1 - else + else echo Clustered replication test passed rm -f repl*.tmp fi diff --git a/cpp/src/tests/ais_check b/cpp/src/tests/cpg_check.sh.in index a865260543..ed97776218 100755 --- a/cpp/src/tests/ais_check +++ b/cpp/src/tests/cpg_check.sh.in @@ -7,9 +7,9 @@ # 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 @@ -18,12 +18,16 @@ # under the License. # -srcdir=`dirname $0` +QPID_USE_CPG=${QPID_USE_CPG:-@USE_CPG@} -# Check AIS requirements and run tests if found. -ps -u root | grep 'aisexec\|corosync' >/dev/null || { - echo WARNING: Skipping cluster tests, the aisexec or corosync daemon is not running. - exit 0; # A warning, not a failure. +# Check if CPG is enabled +cpg_enabled() { + test x$QPID_USE_CPG = xyes || return 1 # disabled + ps -u root | grep 'aisexec\|corosync' >/dev/null || { + echo WARNING: Skip cluster tests, aisexec or corosync daemon is not running. + return 1; # A warning, not a failure. + } + return 0 } # Execute command with the ais group set if user is a member. diff --git a/cpp/src/tests/federated_cluster_test b/cpp/src/tests/federated_cluster_test index 50b877e666..f42b7501b8 100755 --- a/cpp/src/tests/federated_cluster_test +++ b/cpp/src/tests/federated_cluster_test @@ -8,9 +8,9 @@ # 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 @@ -35,7 +35,7 @@ stop_brokers() { if [[ $BROKER_A ]] ; then ../qpidd --no-module-dir -q --port $BROKER_A unset BROKER_A - fi + fi if [[ $NODE_1 ]] ; then ../qpidd --no-module-dir -q --port $NODE_1 unset NODE_1 @@ -92,7 +92,7 @@ run_test_pull_to_cluster_two_consumers() { wait sort -g -k 2 fed1.out.tmp fed2.out.tmp > fed.out.tmp diff fed.in.tmp fed.out.tmp || fail "federated link to cluster failed: expectations not met!" - + rm -f fed*.tmp #cleanup } @@ -106,7 +106,7 @@ run_test_pull_to_cluster() { #verify all messages are received diff fed.in.tmp fed.out.tmp || fail "federated link to cluster failed: expectations not met!" - + rm -f fed*.tmp #cleanup } @@ -121,22 +121,23 @@ run_test_pull_from_cluster() { #verify all messages are received wait diff fed.in.tmp fed.out.tmp || fail "federated link from cluster failed: expectations not met!" - + rm -f fed*.tmp #cleanup } if test -d ${PYTHON_DIR}; then - . $srcdir/ais_check + . cpg_check.sh + cpg_enabled || exit 0 rm -f fed*.tmp #cleanup any files left from previous run start_brokers echo "brokers started" setup echo "setup completed" - run_test_pull_to_cluster_two_consumers + run_test_pull_to_cluster_two_consumers echo "federated link to cluster verified" - run_test_pull_from_cluster + run_test_pull_from_cluster echo "federated link from cluster verified" if [[ $TEST_NODE_FAILURE ]] ; then #kill first cluster node and retest @@ -146,7 +147,7 @@ if test -d ${PYTHON_DIR}; then echo "retesting..." run_test_pull_to_cluster echo "federated link to cluster verified" - run_test_pull_from_cluster - echo "federated link from cluster verified" + run_test_pull_from_cluster + echo "federated link from cluster verified" fi fi diff --git a/cpp/src/tests/ipv6_test b/cpp/src/tests/ipv6_test index 8fa272d514..6becfd8c96 100755 --- a/cpp/src/tests/ipv6_test +++ b/cpp/src/tests/ipv6_test @@ -113,7 +113,8 @@ fi test -z $CLUSTER_LIB && exit 0 # Exit if cluster not supported. ## Test failover in a cluster using IPv6 only -. $srcdir/ais_check # Will exit if clustering not enabled. +. cpg_check.sh +cpg_enabled || exit 0 pick_port() { # We need a fixed port to set --cluster-url. Use qpidd to pick a free port. diff --git a/cpp/src/tests/qpidd-empty.conf b/cpp/src/tests/qpidd-empty.conf new file mode 100644 index 0000000000..bbf52bf446 --- /dev/null +++ b/cpp/src/tests/qpidd-empty.conf @@ -0,0 +1,3 @@ +# An empty configuration file. +# Used when running tests to avoid picking up configuration +# installed in the default place. diff --git a/cpp/src/tests/run_cluster_authentication_soak b/cpp/src/tests/run_cluster_authentication_soak index 7bc406c4ca..24befa28ba 100755 --- a/cpp/src/tests/run_cluster_authentication_soak +++ b/cpp/src/tests/run_cluster_authentication_soak @@ -19,8 +19,9 @@ source ./test_env.sh -source $srcdir/ais_check source sasl_test_setup.sh +source cpg_check.sh +cpg_enabled || exit 0 with_ais_group ./cluster_authentication_soak 500 diff --git a/cpp/src/tests/run_cluster_authentication_test b/cpp/src/tests/run_cluster_authentication_test index 647200b869..844807a857 100755 --- a/cpp/src/tests/run_cluster_authentication_test +++ b/cpp/src/tests/run_cluster_authentication_test @@ -19,8 +19,9 @@ source ./test_env.sh -source $srcdir/ais_check source sasl_test_setup.sh +source cpg_check.sh +cpg_enabled || exit 0 with_ais_group ./cluster_authentication_soak diff --git a/cpp/src/tests/run_cluster_test b/cpp/src/tests/run_cluster_test index c022eea1fe..11df3d63a3 100755 --- a/cpp/src/tests/run_cluster_test +++ b/cpp/src/tests/run_cluster_test @@ -22,5 +22,6 @@ # Run the tests srcdir=`dirname $0` -. $srcdir/ais_check +source cpg_check.sh +cpg_enabled || exit 0 with_ais_group $srcdir/run_test ./cluster_test diff --git a/cpp/src/tests/run_cluster_tests b/cpp/src/tests/run_cluster_tests index e136d3810a..a5cea5ff6e 100755 --- a/cpp/src/tests/run_cluster_tests +++ b/cpp/src/tests/run_cluster_tests @@ -20,7 +20,9 @@ # source ./test_env.sh -source $srcdir/ais_check +source cpg_check.sh +cpg_enabled || exit 0 + test -x $QPID_PYTHON_TEST || { echo Skipping test, $QPID_PYTHON_TEST not found; exit 0; } diff --git a/cpp/src/tests/run_failover_soak b/cpp/src/tests/run_failover_soak index 4c2e8cc188..2c56bf7d6b 100755 --- a/cpp/src/tests/run_failover_soak +++ b/cpp/src/tests/run_failover_soak @@ -20,7 +20,8 @@ # source ./test_env.sh -. $srcdir/ais_check +source cpg_check.sh +cpg_enabled || exit 0 host=127.0.0.1 diff --git a/cpp/src/tests/run_federation_sys_tests b/cpp/src/tests/run_federation_sys_tests index f5f772d72e..76da176914 100755 --- a/cpp/src/tests/run_federation_sys_tests +++ b/cpp/src/tests/run_federation_sys_tests @@ -26,12 +26,8 @@ source ./test_env.sh MODULENAME=federation_sys # Test for clustering -ps -u root | grep 'aisexec\|corosync' > /dev/null -if (( $? == 0 )); then - CLUSTERING_ENABLED=1 -else - echo "WARNING: No clustering detected; tests using it will be ignored." -fi +source cpg_check.sh +if cpg_enabled; then CLUSTERING_ENABLED=1; fi # Test for long test if [[ "$1" == "LONG_TEST" ]]; then diff --git a/cpp/src/tests/sasl.mk b/cpp/src/tests/sasl.mk index 69b24c3f8a..11731dcf40 100644 --- a/cpp/src/tests/sasl.mk +++ b/cpp/src/tests/sasl.mk @@ -20,18 +20,37 @@ # Test that are only relevant if SASL is enabled. if HAVE_SASL +if HAVE_LIBCPG check_PROGRAMS+=cluster_authentication_soak cluster_authentication_soak_INCLUDES=$(PUBLIC_INCLUDES) cluster_authentication_soak_SOURCES=cluster_authentication_soak.cpp ForkedBroker.h ForkedBroker.cpp cluster_authentication_soak_LDADD=$(lib_client) $(lib_broker) +endif HAVE_LIBCPG # Note: sasl_version is not a test -- it is a tool used by tests. check_PROGRAMS+=sasl_version sasl_version_SOURCES=sasl_version.cpp sasl_version_LDADD=$(lib_client) -TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route sasl_fed_ex_route_cluster sasl_fed_ex_link_cluster sasl_fed_ex_queue_cluster sasl_fed_ex_dynamic_cluster sasl_no_dir +TESTS += sasl_fed + sasl_fed_ex_dynamic + sasl_fed_ex_link + sasl_fed_ex_queue + sasl_fed_ex_route + sasl_no_dir + +if HAVE_LIBCPG + +TESTS += run_cluster_authentication_test \ + sasl_fed_ex_route_cluster \ + sasl_fed_ex_link_cluster \ + sasl_fed_ex_queue_cluster \ + sasl_fed_ex_dynamic_cluster + LONG_TESTS += run_cluster_authentication_soak + +endif HAVE_LIBCPG + EXTRA_DIST += run_cluster_authentication_test \ sasl_fed \ sasl_fed_ex \ diff --git a/cpp/src/tests/sasl_fed_ex_dynamic_cluster b/cpp/src/tests/sasl_fed_ex_dynamic_cluster index b0cceccecb..fd6b72a4f2 100755 --- a/cpp/src/tests/sasl_fed_ex_dynamic_cluster +++ b/cpp/src/tests/sasl_fed_ex_dynamic_cluster @@ -21,7 +21,9 @@ source ./test_env.sh -source $srcdir/ais_check +source cpg_check.sh +cpg_enabled || exit 0 + with_ais_group ${srcdir}/sasl_fed_ex dynamic cluster diff --git a/cpp/src/tests/sasl_fed_ex_link_cluster b/cpp/src/tests/sasl_fed_ex_link_cluster index 4139300b12..34b2aa4a5f 100755 --- a/cpp/src/tests/sasl_fed_ex_link_cluster +++ b/cpp/src/tests/sasl_fed_ex_link_cluster @@ -21,7 +21,8 @@ source ./test_env.sh -source $srcdir/ais_check +source cpg_check.sh +cpg_enabled || exit 0 with_ais_group ${srcdir}/sasl_fed_ex link cluster diff --git a/cpp/src/tests/sasl_fed_ex_queue_cluster b/cpp/src/tests/sasl_fed_ex_queue_cluster index f251420e08..14f36f6fc4 100755 --- a/cpp/src/tests/sasl_fed_ex_queue_cluster +++ b/cpp/src/tests/sasl_fed_ex_queue_cluster @@ -21,7 +21,8 @@ source ./test_env.sh -source ${srcdir}/ais_check +source cpg_check.sh +cpg_enabled || exit 0 with_ais_group ${srcdir}/sasl_fed_ex queue cluster diff --git a/cpp/src/tests/sasl_fed_ex_route_cluster b/cpp/src/tests/sasl_fed_ex_route_cluster index a5d1542def..756476056e 100755 --- a/cpp/src/tests/sasl_fed_ex_route_cluster +++ b/cpp/src/tests/sasl_fed_ex_route_cluster @@ -21,7 +21,8 @@ source ./test_env.sh -source ${srcdir}/ais_check +source cpg_check.sh +cpg_enabled || exit 0 with_ais_group ${srcdir}/sasl_fed_ex route cluster diff --git a/cpp/src/tests/ssl_test b/cpp/src/tests/ssl_test index ac978d3bd0..91ff8eec1e 100755 --- a/cpp/src/tests/ssl_test +++ b/cpp/src/tests/ssl_test @@ -192,7 +192,8 @@ stop_brokers test -z $CLUSTER_LIB && exit 0 # Exit if cluster not supported. ## Test failover in a cluster using SSL only -. $srcdir/ais_check # Will exit if clustering not enabled. +source cpg_check.sh +cpg_enabled || exit 0 PORT1=`pick_port`; ssl_cluster_broker $PORT1 echo "Running SSL cluster broker on port $PORT1" diff --git a/cpp/src/tests/start_cluster b/cpp/src/tests/start_cluster index 84f98b3b2d..78fd104d9c 100755 --- a/cpp/src/tests/start_cluster +++ b/cpp/src/tests/start_cluster @@ -24,7 +24,8 @@ # Execute command with the ais group set. source ./test_env.sh -. `dirname $0`/ais_check +source cpg_check.sh +cpg_enabled || exit 0 rm -f cluster*.log cluster.ports qpidd.port diff --git a/cpp/src/tests/test_env.sh.in b/cpp/src/tests/test_env.sh.in index 5c07bcdc2e..cee36843ae 100644 --- a/cpp/src/tests/test_env.sh.in +++ b/cpp/src/tests/test_env.sh.in @@ -75,6 +75,7 @@ exportmodule XML_LIB xml.so # Qpid options export QPID_NO_MODULE_DIR=1 # Don't accidentally load installed modules export QPID_DATA_DIR= +export QPID_CONFIG=$srcdir/qpidd-empty.conf # Use temporary directory if $HOME does not exist if [ ! -e "$HOME" ]; then |