diff options
author | Alan Conway <aconway@apache.org> | 2010-05-27 20:02:30 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2010-05-27 20:02:30 +0000 |
commit | b0ed6faecb9d7dbbe91ac39af6bbdc2ad412253c (patch) | |
tree | a55d8ee9de910a9d120b72247820746e9f94957f /cpp/src/tests | |
parent | 0b717b95d472d96f32395df14a5a6433fdbbae1c (diff) | |
download | qpid-python-b0ed6faecb9d7dbbe91ac39af6bbdc2ad412253c.tar.gz |
Fix problems with cluster_authentication_soak test in VPATH build.
- Fix SASL version testing logic in cluster_authentication_soak and SaslAuthenticator
- Generate all SASL config in the build directory in sasl_test_setup.sh
- Compile cluster_authentication_soak only if SASL is available.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@948968 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
-rw-r--r-- | cpp/src/tests/Makefile.am | 13 | ||||
-rw-r--r-- | cpp/src/tests/cluster_authentication_soak.cpp | 18 | ||||
-rwxr-xr-x | cpp/src/tests/run_cluster_authentication_soak | 13 | ||||
-rwxr-xr-x | cpp/src/tests/run_cluster_authentication_test | 13 | ||||
-rw-r--r-- | cpp/src/tests/sasl.mk | 31 | ||||
-rw-r--r-- | cpp/src/tests/sasl_config/qpidd.conf | 45 | ||||
-rwxr-xr-x | cpp/src/tests/sasl_test_setup.sh | 21 |
7 files changed, 65 insertions, 89 deletions
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am index 99b226b004..061d7e88f6 100644 --- a/cpp/src/tests/Makefile.am +++ b/cpp/src/tests/Makefile.am @@ -146,6 +146,7 @@ test_store_la_LIBADD = $(lib_broker) test_store_la_LDFLAGS = -module include cluster.mk +include sasl.mk if SSL include ssl.mk endif @@ -248,11 +249,6 @@ failover_soak_INCLUDES=$(PUBLIC_INCLUDES) failover_soak_SOURCES=failover_soak.cpp ForkedBroker.h ForkedBroker.cpp failover_soak_LDADD=$(lib_client) $(lib_broker) -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) - check_PROGRAMS+=declare_queues declare_queues_INCLUDES=$(PUBLIC_INCLUDES) declare_queues_SOURCES=declare_queues.cpp @@ -314,7 +310,7 @@ TESTS_ENVIRONMENT = \ $(srcdir)/run_test system_tests = qpid-client-test quick_perftest quick_topictest run_header_test quick_txtest -TESTS += start_broker $(system_tests) python_tests stop_broker run_federation_tests run_acl_tests run_cli_tests replication_test run_cluster_authentication_test +TESTS += start_broker $(system_tests) python_tests stop_broker run_federation_tests run_acl_tests run_cli_tests replication_test EXTRA_DIST += \ run_test vg_check \ @@ -351,7 +347,7 @@ EXTRA_DIST += \ run_test.ps1 \ start_broker.ps1 \ stop_broker.ps1 \ - topictest.ps1 \ + topictest.ps1 \ run_cluster_authentication_test check_LTLIBRARIES += libdlclose_noop.la @@ -365,8 +361,7 @@ CLEANFILES+=valgrind.out *.log *.vglog* dummy_test qpidd.port $(unit_wrappers) LONG_TESTS+=start_broker fanout_perftest shared_perftest multiq_perftest topic_perftest run_ring_queue_test stop_broker \ run_failover_soak reliable_replication_test \ - federated_cluster_test_with_node_failure \ - run_cluster_authentication_soak + federated_cluster_test_with_node_failure EXTRA_DIST+= \ fanout_perftest \ diff --git a/cpp/src/tests/cluster_authentication_soak.cpp b/cpp/src/tests/cluster_authentication_soak.cpp index 9e878be6d1..31714a19a6 100644 --- a/cpp/src/tests/cluster_authentication_soak.cpp +++ b/cpp/src/tests/cluster_authentication_soak.cpp @@ -43,6 +43,7 @@ #include <ForkedBroker.h> #include <qpid/client/Connection.h> +#include <sasl/sasl.h> #ifdef HAVE_CONFIG_H #include "config.h" @@ -117,13 +118,13 @@ bool runPerftest ( bool hangTest ) { stringstream portSs; portSs << newbiePort; - + string portStr = portSs.str(); char const * path = "./qpid-perftest"; vector<char const *> argv; argv.push_back ( "./qpid-perftest" ); argv.push_back ( "-p" ); - argv.push_back ( portSs.str().c_str() ); + argv.push_back ( portStr.c_str() ); argv.push_back ( "--username" ); argv.push_back ( "zig" ); argv.push_back ( "--password" ); @@ -166,7 +167,7 @@ runPerftest ( bool hangTest ) { if ( returned_pid == pid ) { int exit_status = WEXITSTATUS(status); if ( exit_status ) { - cerr << "qpid-perftest failed. exit_status was: " << exit_status; + cerr << "qpid-perftest failed. exit_status was: " << exit_status << endl; return false; } else { @@ -242,9 +243,10 @@ int main ( int argc, char ** argv ) { // I need the SASL_PATH_TYPE_CONFIG feature, which did not appear until SASL 2.1.22 - #if (SASL_VERSION_MAJOR < 2) || (SASL_VERSION_MINOR < 1) || (SASL_VERSION_STEP < 22) +#if (SASL_VERSION_FULL < ((2<<16)|(1<<8)|22)) + cout << "Skipping SASL test, SASL version too low." << endl; return 0; - #endif +#endif int n_iterations = argc > 1 ? atoi(argv[1]) : 1; runSilent = argc > 2 ? atoi(argv[2]) : 1; // default to silent @@ -253,12 +255,6 @@ main ( int argc, char ** argv ) int n_brokers = 3; brokerVector brokers; - #ifndef HAVE_SASL - if ( ! runSilent ) - cout << "No SASL support. cluster_authentication_soak disabled."; - return 0; - #endif - srand ( getpid() ); string clusterName; makeClusterName ( clusterName ); diff --git a/cpp/src/tests/run_cluster_authentication_soak b/cpp/src/tests/run_cluster_authentication_soak index 2bb7a833f6..dd2368edbc 100755 --- a/cpp/src/tests/run_cluster_authentication_soak +++ b/cpp/src/tests/run_cluster_authentication_soak @@ -1,16 +1,5 @@ #! /bin/bash -SASL_PW=/usr/sbin/saslpasswd2 -SASLTEST_DB=./sasl_config/qpidd.sasldb - -if [ -e $SASL_PW ] -then - echo "Building temporary sasl db." - rm -f $SASLTEST_DB - echo zig | $SASL_PW -c -p -f $SASLTEST_DB -u QPID zig - echo zag | $SASL_PW -c -p -f $SASLTEST_DB -u QPID zag -fi - -# This test will return something reasonable whether or not sasl exists. +source sasl_test_setup.sh ./cluster_authentication_soak 500 diff --git a/cpp/src/tests/run_cluster_authentication_test b/cpp/src/tests/run_cluster_authentication_test index 15597e7073..0e102490b1 100755 --- a/cpp/src/tests/run_cluster_authentication_test +++ b/cpp/src/tests/run_cluster_authentication_test @@ -1,16 +1,5 @@ #! /bin/bash -SASL_PW=/usr/sbin/saslpasswd2 -SASLTEST_DB=./sasl_config/qpidd.sasldb - -if [ -e $SASL_PW ] -then - echo "Building temporary sasl db." - rm -f $SASLTEST_DB - echo zig | $SASL_PW -c -p -f $SASLTEST_DB -u QPID zig - echo zag | $SASL_PW -c -p -f $SASLTEST_DB -u QPID zag -fi - -# This test will return something reasonable whether or not sasl exists. +source sasl_test_setup.sh ./cluster_authentication_soak diff --git a/cpp/src/tests/sasl.mk b/cpp/src/tests/sasl.mk new file mode 100644 index 0000000000..52cebe63f6 --- /dev/null +++ b/cpp/src/tests/sasl.mk @@ -0,0 +1,31 @@ +# +# 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. +# + +# Test that are only relevant if SASL is enabled. +if HAVE_SASL + +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) + +TESTS += run_cluster_authentication_test +LONG_TESTS += run_cluster_authentication_soak + +endif # HAVE_SASL diff --git a/cpp/src/tests/sasl_config/qpidd.conf b/cpp/src/tests/sasl_config/qpidd.conf deleted file mode 100644 index 62fd8d4dee..0000000000 --- a/cpp/src/tests/sasl_config/qpidd.conf +++ /dev/null @@ -1,45 +0,0 @@ -# -# 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. -# -# -# This configuation allows for either SASL PLAIN or ANONYMOUS -# authentication. The PLAIN authentication is done on a -# username+password, which is stored in the sasldb_path -# file. Usernames and passwords can be added to the file using the -# command: -# -# saslpasswd2 -f /var/lib/qpidd/qpidd.sasldb -u <REALM> <USER> -# -# The REALM is important and should be the same as the --auth-realm -# option to the broker. This lets the broker properly find the user in -# the sasldb file. -# -# Existing user accounts may be listed with: -# -# sasldblistusers2 -f /var/lib/qpidd/qpidd.sasldb -# -# NOTE: The sasldb file must be readable by the user running the qpidd -# daemon, and should be readable only by that user. -# -pwcheck_method: auxprop -auxprop_plugin: sasldb -sasldb_path: ./sasl_config/qpidd.sasldb - -#following line stops spurious 'sql_select option missing' errors when -#cyrus-sql-sasl plugin is installed -sql_select: dummy select diff --git a/cpp/src/tests/sasl_test_setup.sh b/cpp/src/tests/sasl_test_setup.sh new file mode 100755 index 0000000000..68858b2c0a --- /dev/null +++ b/cpp/src/tests/sasl_test_setup.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +SASL_PW=/usr/sbin/saslpasswd2 +test -x $SASL_PW || { echo Skipping SASL test, saslpasswd2 not found; exit 0; } + +mkdir -p sasl_config + +# Create configuration file. +cat > sasl_config/qpidd.conf <<EOF +pwcheck_method: auxprop +auxprop_plugin: sasldb +sasldb_path: ./sasl_config/qpidd.sasldb +sql_select: dummy select +EOF + +# Populate temporary sasl db. +SASLTEST_DB=./sasl_config/qpidd.sasldb +rm -f $SASLTEST_DB +echo zig | $SASL_PW -c -p -f $SASLTEST_DB -u QPID zig +echo zag | $SASL_PW -c -p -f $SASLTEST_DB -u QPID zag + |