summaryrefslogtreecommitdiff
path: root/cpp/src/tests
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-05-27 20:02:41 +0000
committerAlan Conway <aconway@apache.org>2010-05-27 20:02:41 +0000
commit9e82faab313bab906dc1e6e2dda02b4db9dbf993 (patch)
tree94a61638d14d20588414b3fe1386518d07c76f46 /cpp/src/tests
parentb0ed6faecb9d7dbbe91ac39af6bbdc2ad412253c (diff)
downloadqpid-python-9e82faab313bab906dc1e6e2dda02b4db9dbf993.tar.gz
Fixed: authentication with bad credentials causes cluster broker to exit.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@948969 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
-rw-r--r--cpp/src/tests/Makefile.am6
-rwxr-xr-xcpp/src/tests/cluster_tests.py12
-rwxr-xr-xcpp/src/tests/sasl_test_setup.sh3
3 files changed, 19 insertions, 2 deletions
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am
index 061d7e88f6..5e5bfdec37 100644
--- a/cpp/src/tests/Makefile.am
+++ b/cpp/src/tests/Makefile.am
@@ -376,7 +376,7 @@ EXTRA_DIST+= \
check-long:
$(MAKE) check TESTS="$(LONG_TESTS)" VALGRIND=
-check: python_prep test_env.sh
+check: python_prep test_env.sh sasl_config
PYTHON_SRC_DIR=$(abs_srcdir)/../../../python
PYTHON_BLD_DIR=$(abs_builddir)/python
@@ -391,4 +391,8 @@ python_prep:
--install-scripts=$(PYTHON_BLD_DIR)/commands; \
else echo "WARNING: python client not built, missing $(PYTHON_SRC_DIR)"; fi
+sasl_config: sasl_test_setup.sh
+ sh $(srcdir)/sasl_test_setup.sh
+ touch sasl_config
+
include testagent.mk
diff --git a/cpp/src/tests/cluster_tests.py b/cpp/src/tests/cluster_tests.py
index f36cde9ecc..02b3b29571 100755
--- a/cpp/src/tests/cluster_tests.py
+++ b/cpp/src/tests/cluster_tests.py
@@ -101,6 +101,18 @@ class ShortTests(BrokerTest):
assert readfile("direct.dump") == readfile("updatee.dump")
os.remove("direct.dump")
os.remove("updatee.dump")
+
+ def test_sasl(self):
+ """Test SASL authentication and encryption in a cluster"""
+ sasl_config=os.path.join(self.rootdir, "sasl_config")
+ cluster = self.cluster(3, ["--auth", "yes", "--sasl-config", sasl_config])
+ # Try a bad user ID
+ try:
+ c = messaging.Connection.establish("nosuch/user@%s"%(cluster[0].host_port()))
+ self.fail("Expected exception")
+ except messaging.exceptions.ConnectionError: pass
+ for b in cluster: b.ready() # Make sure all brokers still running.
+
class LongTests(BrokerTest):
"""Tests that can run for a long time if -DDURATION=<minutes> is set"""
diff --git a/cpp/src/tests/sasl_test_setup.sh b/cpp/src/tests/sasl_test_setup.sh
index 68858b2c0a..69748beece 100755
--- a/cpp/src/tests/sasl_test_setup.sh
+++ b/cpp/src/tests/sasl_test_setup.sh
@@ -9,13 +9,14 @@ mkdir -p sasl_config
cat > sasl_config/qpidd.conf <<EOF
pwcheck_method: auxprop
auxprop_plugin: sasldb
-sasldb_path: ./sasl_config/qpidd.sasldb
+sasldb_path: $PWD/sasl_config/qpidd.sasldb
sql_select: dummy select
EOF
# Populate temporary sasl db.
SASLTEST_DB=./sasl_config/qpidd.sasldb
rm -f $SASLTEST_DB
+echo guest | $SASL_PW -c -p -f $SASLTEST_DB -u QPID guest
echo zig | $SASL_PW -c -p -f $SASLTEST_DB -u QPID zig
echo zag | $SASL_PW -c -p -f $SASLTEST_DB -u QPID zag