summaryrefslogtreecommitdiff
path: root/cpp/src/tests/cluster_tests.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-10-30 15:52:48 +0000
committerAlan Conway <aconway@apache.org>2009-10-30 15:52:48 +0000
commitab794904145b2e6a79da063f1aec9ae87953ea22 (patch)
tree1673e51ce26fb71a8502833b2bc3b7586312ae41 /cpp/src/tests/cluster_tests.py
parent8039e10f1d300aaaf1b56263db5336c6c38cfd49 (diff)
downloadqpid-python-ab794904145b2e6a79da063f1aec9ae87953ea22.tar.gz
Python framework for tests that start multiple brokers.
This is intended to become a general framework for python scripting tests that start multiple brokers and executable clients, e.g. cluster and federation tests. This framework is intended to replace testlib.py once there is equivalent test coverage from new-style tests. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@831350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/cluster_tests.py')
-rwxr-xr-xcpp/src/tests/cluster_tests.py40
1 files changed, 36 insertions, 4 deletions
diff --git a/cpp/src/tests/cluster_tests.py b/cpp/src/tests/cluster_tests.py
index a0b9c420d9..3613f564bd 100755
--- a/cpp/src/tests/cluster_tests.py
+++ b/cpp/src/tests/cluster_tests.py
@@ -18,12 +18,44 @@
# under the License.
#
-import os, signal, sys, unittest
-from testlib import TestBaseCluster
+import os, signal, sys
+from brokertest import *
+from qpid import datatypes, messaging, tests
+from testlib import TestBaseCluster # Old framework
+
+# New framework tests
+class NewTests(BrokerTest):
+
+ def test_basic(self):
+ """Test basic cluster message replication."""
+ # Start a cluster, send some messages to member 0.
+ cluster = Cluster(self, 2)
+ s0 = cluster[0].connect().session()
+ s0.sender("q {create:always}").send(messaging.Message("x"))
+ s0.sender("q {create:always}").send(messaging.Message("y"))
+ s0.connection.close()
+
+ # Verify messages available on member 1.
+ s1 = cluster[1].connect().session()
+ m = s1.receiver("q", capacity=1).fetch(timeout=1)
+ s1.acknowledge()
+ self.assertEqual("x", m.content)
+ s1.connection.close()
+
+ # Start member 2 and verify messages available.
+ s2 = cluster.start().connect().session()
+ m = s2.receiver("q", capacity=1).fetch(timeout=1)
+ s1.acknowledge()
+ self.assertEqual("y", m.content)
+ s2.connection.close()
+
+ self.passed()
+
+# Old framework tests
class ShortTests(TestBaseCluster):
"""Basic cluster with async store tests"""
-
+
def test_01_Initialization(self):
"""Start a single cluster containing several nodes, and stop it again"""
try:
@@ -401,5 +433,5 @@ class LongTests(TestBaseCluster):
if __name__ == '__main__':
if os.getenv("STORE_LIB") != None:
print "NOTE: Store enabled for the following tests:"
- if not unittest.main(): sys.exit(1)
+ if not test.main(): sys.exit(1)