You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2012/05/04 17:40:13 UTC
svn commit: r1334037 [10/24] - in /qpid/branches/asyncstore: ./ bin/ cc/
cpp/ cpp/bindings/ cpp/bindings/qmf/ruby/ cpp/bindings/qmf/tests/
cpp/bindings/qpid/ cpp/bindings/qpid/dotnet/ cpp/bindings/qpid/python/
cpp/bindings/qpid/ruby/ cpp/bindings/qpid/...
Modified: qpid/branches/asyncstore/cpp/src/tests/cluster_tests.py
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/cluster_tests.py?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/cluster_tests.py (original)
+++ qpid/branches/asyncstore/cpp/src/tests/cluster_tests.py Fri May 4 15:39:19 2012
@@ -277,7 +277,7 @@ acl deny all all
QMF-based tools - regression test for BZ615300."""
broker1 = self.cluster(1)[0]
broker2 = self.cluster(1)[0]
- qs = subprocess.Popen(["qpid-stat", "-e", broker1.host_port()], stdout=subprocess.PIPE)
+ qs = subprocess.Popen(["qpid-stat", "-e", "-b", broker1.host_port()], stdout=subprocess.PIPE)
out = qs.communicate()[0]
assert out.find("amq.failover") > 0
@@ -767,6 +767,124 @@ acl deny all all
cluster.start()
fetch(cluster[2])
+
+ def test_federation_failover(self):
+ """
+ Verify that federation operates across failures occuring in a cluster.
+ Specifically:
+ 1) Destination cluster learns of membership changes in the source
+ cluster
+ 2) Destination cluster replicates the current state of the source
+ cluster to newly-added members
+ """
+
+ TIMEOUT = 30
+ def verify(src_broker, src, dst_broker, dst, timeout=TIMEOUT):
+ """ Prove that traffic can pass from source fed broker to
+ destination fed broker
+ """
+ tot_time = 0
+ active = False
+ send_session = src_broker.connect().session()
+ sender = send_session.sender(src)
+ receive_session = dst_broker.connect().session()
+ receiver = receive_session.receiver(dst)
+ while not active and tot_time < timeout:
+ sender.send(Message("Hello from Source!"))
+ try:
+ receiver.fetch(timeout = 1)
+ receive_session.acknowledge()
+ # Get this far without Empty exception, and the link is good!
+ active = True
+ while True:
+ # Keep receiving msgs, as several may have accumulated
+ receiver.fetch(timeout = 1)
+ receive_session.acknowledge()
+ except Empty:
+ if not active:
+ tot_time += 1
+ receiver.close()
+ receive_session.close()
+ sender.close()
+ send_session.close()
+ self.assertTrue(active, "Bridge failed to become active")
+
+
+ # 2 node cluster source, 2 node cluster destination
+ src_cluster = self.cluster(2, expect=EXPECT_EXIT_FAIL)
+ src_cluster.ready();
+ dst_cluster = self.cluster(2, expect=EXPECT_EXIT_FAIL)
+ dst_cluster.ready();
+
+ cmd = self.popen(["qpid-config",
+ "--broker", src_cluster[0].host_port(),
+ "add", "queue", "srcQ"], EXPECT_EXIT_OK)
+ cmd.wait()
+
+ cmd = self.popen(["qpid-config",
+ "--broker", dst_cluster[0].host_port(),
+ "add", "exchange", "fanout", "destX"], EXPECT_EXIT_OK)
+ cmd.wait()
+
+ cmd = self.popen(["qpid-config",
+ "--broker", dst_cluster[0].host_port(),
+ "add", "queue", "destQ"], EXPECT_EXIT_OK)
+ cmd.wait()
+
+ cmd = self.popen(["qpid-config",
+ "--broker", dst_cluster[0].host_port(),
+ "bind", "destX", "destQ"], EXPECT_EXIT_OK)
+ cmd.wait()
+
+ # federate the srcQ to the destination exchange
+ dst_cluster[0].startQmf()
+ dst_broker = dst_cluster[0].qmf_session.getObjects(_class="broker")[0]
+ result = dst_broker.connect(src_cluster[0].host(), src_cluster[0].port(), False, "PLAIN",
+ "guest", "guest", "tcp")
+ self.assertEqual(result.status, 0, result);
+
+ link = dst_cluster[0].qmf_session.getObjects(_class="link")[0]
+ result = link.bridge(False, "srcQ", "destX", "", "", "", True, False, False, 10)
+ self.assertEqual(result.status, 0, result)
+
+ # check that traffic passes
+ verify(src_cluster[0], "srcQ", dst_cluster[0], "destQ")
+
+ # add src[2] broker to source cluster
+ src_cluster.start(expect=EXPECT_EXIT_FAIL);
+ src_cluster.ready();
+ verify(src_cluster[2], "srcQ", dst_cluster[0], "destQ")
+
+ # Kill src[0]. dst[0] should fail over to src[1]
+ src_cluster[0].kill()
+ for b in src_cluster[1:]: b.ready()
+ verify(src_cluster[1], "srcQ", dst_cluster[0], "destQ")
+
+ # Kill src[1], dst[0] should fail over to src[2]
+ src_cluster[1].kill()
+ for b in src_cluster[2:]: b.ready()
+ verify(src_cluster[2], "srcQ", dst_cluster[0], "destQ")
+
+ # Kill dest[0], force failover to dest[1]
+ dst_cluster[0].kill()
+ for b in dst_cluster[1:]: b.ready()
+ verify(src_cluster[2], "srcQ", dst_cluster[1], "destQ")
+
+ # Add dest[2]
+ # dest[1] syncs dest[2] to current remote state
+ dst_cluster.start(expect=EXPECT_EXIT_FAIL);
+ for b in dst_cluster[1:]: b.ready()
+ verify(src_cluster[2], "srcQ", dst_cluster[1], "destQ")
+
+ # Kill dest[1], force failover to dest[2]
+ dst_cluster[1].kill()
+ for b in dst_cluster[2:]: b.ready()
+ verify(src_cluster[2], "srcQ", dst_cluster[2], "destQ")
+
+ for i in range(2, len(src_cluster)): src_cluster[i].kill()
+ for i in range(2, len(dst_cluster)): dst_cluster[i].kill()
+
+
# Some utility code for transaction tests
XA_RBROLLBACK = 1
XA_RBTIMEOUT = 2
@@ -1160,7 +1278,7 @@ class LongTests(BrokerTest):
def start_mclients(broker):
"""Start management clients that make multiple connections."""
- cmd = ["qpid-stat", "-b", "localhost:%s" %(broker.port())]
+ cmd = ["qpid-cluster", "-C", "localhost:%s" %(broker.port())]
mclients.append(ClientLoop(broker, cmd))
endtime = time.time() + self.duration()
Propchange: qpid/branches/asyncstore/cpp/src/tests/cluster_tests.py
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/cpp/src/tests/cluster_tests.py:r1291265-1333987
Modified: qpid/branches/asyncstore/cpp/src/tests/clustered_replication_test
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/clustered_replication_test?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/clustered_replication_test (original)
+++ qpid/branches/asyncstore/cpp/src/tests/clustered_replication_test Fri May 4 15:39:19 2012
@@ -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)_$$
@@ -65,8 +66,8 @@ if test -d $PYTHON_DIR; then
#start first node of primary cluster and set up test queue
echo Starting primary cluster
PRIMARY1=$(with_ais_group $QPIDD_EXEC $GENERAL_OPTS $PRIMARY_OPTS --log-to-file repl.primary.1.tmp) || fail "Could not start PRIMARY1"
- $PYTHON_COMMANDS/qpid-config -a "localhost:$PRIMARY1" add queue test-queue --generate-queue-events 2
- $PYTHON_COMMANDS/qpid-config -a "localhost:$PRIMARY1" add queue control-queue --generate-queue-events 1
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$PRIMARY1" add queue test-queue --generate-queue-events 2
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$PRIMARY1" add queue control-queue --generate-queue-events 1
#send 10 messages, consume 5 of them
for i in `seq 1 10`; do echo Message$i; done | ./sender --port $PRIMARY1
@@ -81,28 +82,28 @@ if test -d $PYTHON_DIR; then
DR1=$(with_ais_group $QPIDD_EXEC $GENERAL_OPTS $DR_OPTS --log-to-file repl.dr.1.tmp) || fail "Could not start DR1"
DR2=$(with_ais_group $QPIDD_EXEC $GENERAL_OPTS $DR_OPTS --log-to-file repl.dr.2.tmp) || fail "Could not start DR2"
- $PYTHON_COMMANDS/qpid-config -a "localhost:$DR1" add queue test-queue
- $PYTHON_COMMANDS/qpid-config -a "localhost:$DR1" add queue control-queue
- $PYTHON_COMMANDS/qpid-config -a "localhost:$DR1" add exchange replication REPLICATION_EXCHANGE
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$DR1" add queue test-queue
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$DR1" add queue control-queue
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$DR1" add exchange replication REPLICATION_EXCHANGE
$PYTHON_COMMANDS/qpid-route queue add localhost:$DR2 localhost:$PRIMARY2 REPLICATION_EXCHANGE REPLICATION_QUEUE || fail "Could not add route."
#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
Modified: qpid/branches/asyncstore/cpp/src/tests/federated_cluster_test
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/federated_cluster_test?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/federated_cluster_test (original)
+++ qpid/branches/asyncstore/cpp/src/tests/federated_cluster_test Fri May 4 15:39:19 2012
@@ -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
@@ -63,20 +63,20 @@ start_brokers() {
setup() {
#create exchange on both cluster and single broker
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add exchange direct test-exchange
- $PYTHON_COMMANDS/qpid-config -a "localhost:$NODE_1" add exchange direct test-exchange
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add exchange direct test-exchange
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$NODE_1" add exchange direct test-exchange
#create dynamic routes for test exchange
$PYTHON_COMMANDS/qpid-route dynamic add "localhost:$NODE_2" "localhost:$BROKER_A" test-exchange
$PYTHON_COMMANDS/qpid-route dynamic add "localhost:$BROKER_A" "localhost:$NODE_2" test-exchange
#create test queue on cluster and bind it to the test exchange
- $PYTHON_COMMANDS/qpid-config -a "localhost:$NODE_1" add queue test-queue
- $PYTHON_COMMANDS/qpid-config -a "localhost:$NODE_1" bind test-exchange test-queue to-cluster
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$NODE_1" add queue test-queue
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$NODE_1" bind test-exchange test-queue to-cluster
#create test queue on single broker and bind it to the test exchange
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue test-queue
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" bind test-exchange test-queue from-cluster
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue test-queue
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" bind test-exchange test-queue from-cluster
}
run_test_pull_to_cluster_two_consumers() {
@@ -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
Modified: qpid/branches/asyncstore/cpp/src/tests/ha_tests.py
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/ha_tests.py?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/ha_tests.py (original)
+++ qpid/branches/asyncstore/cpp/src/tests/ha_tests.py Fri May 4 15:39:19 2012
@@ -18,71 +18,125 @@
# under the License.
#
-import os, signal, sys, time, imp, re, subprocess, glob, random, logging, shutil
-from qpid.messaging import Message, NotFound, ConnectionError, Connection
+import os, signal, sys, time, imp, re, subprocess, glob, random, logging, shutil, math
+from qpid.messaging import Message, NotFound, ConnectionError, ReceiverError, Connection
+from qpid.datatypes import uuid4
from brokertest import *
from threading import Thread, Lock, Condition
from logging import getLogger, WARN, ERROR, DEBUG
+from qpidtoollibs import BrokerAgent
-
-log = getLogger("qpid.ha-tests")
+log = getLogger(__name__)
class HaBroker(Broker):
- def __init__(self, test, args=[], broker_url=None, **kwargs):
+ def __init__(self, test, args=[], broker_url=None, ha_cluster=True,
+ ha_replicate="all", **kwargs):
assert BrokerTest.ha_lib, "Cannot locate HA plug-in"
- args=["--load-module", BrokerTest.ha_lib,
- # FIXME aconway 2012-02-13: workaround slow link failover.
- "--link-maintenace-interval=0.1",
- "--ha-enable=yes"]
- if broker_url: args += [ "--ha-broker-url", broker_url ]
+ args = copy(args)
+ args += ["--load-module", BrokerTest.ha_lib,
+ "--log-enable=info+", "--log-enable=debug+:ha::",
+ # FIXME aconway 2012-02-13: workaround slow link failover.
+ "--link-maintenace-interval=0.1",
+ "--ha-cluster=%s"%ha_cluster]
+ if ha_replicate is not None:
+ args += [ "--ha-replicate=%s"%ha_replicate ]
+ if broker_url: args.extend([ "--ha-brokers", broker_url ])
Broker.__init__(self, test, args, **kwargs)
+ self.commands=os.getenv("PYTHON_COMMANDS")
+ assert os.path.isdir(self.commands)
+ getLogger().setLevel(ERROR) # Hide expected WARNING log messages from failover.
def promote(self):
- assert os.system("qpid-ha-tool --promote %s"%(self.host_port())) == 0
+ assert os.system("%s/qpid-ha promote -b %s"%(self.commands, self.host_port())) == 0
def set_client_url(self, url):
assert os.system(
- "qpid-ha-tool --client-addresses=%s %s"%(url,self.host_port())) == 0
+ "%s/qpid-ha set --public-brokers=%s -b %s"%(self.commands, url,self.host_port())) == 0
def set_broker_url(self, url):
assert os.system(
- "qpid-ha-tool --broker-addresses=%s %s"%(url, self.host_port())) == 0
+ "%s/qpid-ha set --brokers=%s -b %s"%(self.commands, url, self.host_port())) == 0
+
+ def replicate(self, from_broker, queue):
+ assert os.system(
+ "%s/qpid-ha replicate -b %s %s %s"%(self.commands, self.host_port(), from_broker, queue)) == 0
+ def config_replicate(self, from_broker, queue):
+ assert os.system(
+ "%s/qpid-config --broker=%s add queue --start-replica %s %s"%(self.commands, self.host_port(), from_broker, queue)) == 0
-class ShortTests(BrokerTest):
- """Short HA functionality tests."""
+ def config_declare(self, queue, replication):
+ assert os.system(
+ "%s/qpid-config --broker=%s add queue %s --replicate %s"%(self.commands, self.host_port(), queue, replication)) == 0
- # Wait for an address to become valid.
- def wait(self, session, address):
- def check():
- try:
- session.sender(address)
- return True
- except NotFound: return False
- assert retry(check), "Timed out waiting for %s"%(address)
-
- # Wait for address to become valid on a backup broker.
- def wait_backup(self, backup, address):
- bs = self.connect_admin(backup).session()
- self.wait(bs, address)
- bs.connection.close()
-
- # Combines wait_backup and assert_browse_retry
- def assert_browse_backup(self, backup, queue, expected, **kwargs):
- bs = self.connect_admin(backup).session()
- self.wait(bs, queue)
- self.assert_browse_retry(bs, queue, expected, **kwargs)
- bs.connection.close()
+ def connect_admin(self, **kwargs):
+ return Broker.connect(self, client_properties={"qpid.ha-admin":1}, **kwargs)
- def assert_missing(self, session, address):
+ def wait_backup(self, address):
+ """Wait for address to become valid on a backup broker."""
+ bs = self.connect_admin().session()
+ try: wait_address(bs, address)
+ finally: bs.connection.close()
+
+ def assert_browse_backup(self, queue, expected, **kwargs):
+ """Combines wait_backup and assert_browse_retry."""
+ bs = self.connect_admin().session()
try:
- session.receiver(address)
- self.fail("Should not have been replicated: %s"%(address))
- except NotFound: pass
+ wait_address(bs, queue)
+ assert_browse_retry(bs, queue, expected, **kwargs)
+ finally: bs.connection.close()
+
+class HaCluster(object):
+ _cluster_count = 0
+
+ def __init__(self, test, n, **kwargs):
+ """Start a cluster of n brokers"""
+ self.test = test
+ self._brokers = [ HaBroker(test, name="broker%s-%s"%(HaCluster._cluster_count, i), **kwargs) for i in xrange(n)]
+ HaCluster._cluster_count += 1
+ self.url = ",".join([b.host_port() for b in self])
+ for b in self: b.set_broker_url(self.url)
+ self[0].promote()
+
+ def connect(self, i):
+ """Connect with reconnect_urls"""
+ return self[i].connect(reconnect=True, reconnect_urls=self.url.split(","))
+
+ def kill(self, i):
+ """Kill broker i, promote broker i+1"""
+ self[i].kill()
+ self[i].expect = EXPECT_EXIT_FAIL
+ self[(i+1) % len(self)].promote()
+
+ def bounce(self, i):
+ """Stop and restart a broker in a cluster."""
+ self.kill(i)
+ b = self[i]
+ self._brokers[i] = HaBroker(self.test, name=b.name, port=b.port(), broker_url=self.url)
+
+ # Behave like a list of brokers.
+ def __len__(self): return len(self._brokers)
+ def __getitem__(self,index): return self._brokers[index]
+ def __iter__(self): return self._brokers.__iter__()
+
+def wait_address(session, address):
+ """Wait for an address to become valid."""
+ def check():
+ try:
+ session.sender(address)
+ return True
+ except NotFound: return False
+ assert retry(check), "Timed out waiting for address %s"%(address)
+
+def assert_missing(session, address):
+ """Assert that the address is _not_ valid"""
+ try:
+ session.receiver(address)
+ self.fail("Expected NotFound: %s"%(address))
+ except NotFound: pass
- def connect_admin(self, backup, **kwargs):
- """Connect to a backup broker as an admin connection"""
- return backup.connect(client_properties={"qpid.ha-admin":1}, **kwargs)
+class ReplicationTests(BrokerTest):
+ """Correctness tests for HA replication."""
def test_replication(self):
"""Test basic replication of configuration and messages before and
@@ -95,21 +149,21 @@ class ShortTests(BrokerTest):
return"%s;{create:always,node:{type:topic,x-declare:{arguments:{'qpid.replicate':%s}, type:'fanout'},x-bindings:[{exchange:'%s',queue:'%s'}]}}"%(name, replicate, name, bindq)
def setup(p, prefix, primary):
"""Create config, send messages on the primary p"""
- s = p.sender(queue(prefix+"q1", "messages"))
+ s = p.sender(queue(prefix+"q1", "all"))
for m in ["a", "b", "1"]: s.send(Message(m))
# Test replication of dequeue
self.assertEqual(p.receiver(prefix+"q1").fetch(timeout=0).content, "a")
p.acknowledge()
p.sender(queue(prefix+"q2", "configuration")).send(Message("2"))
p.sender(queue(prefix+"q3", "none")).send(Message("3"))
- p.sender(exchange(prefix+"e1", "messages", prefix+"q1")).send(Message("4"))
- p.sender(exchange(prefix+"e2", "messages", prefix+"q2")).send(Message("5"))
+ p.sender(exchange(prefix+"e1", "all", prefix+"q1")).send(Message("4"))
+ p.sender(exchange(prefix+"e2", "all", prefix+"q2")).send(Message("5"))
# Test unbind
- p.sender(queue(prefix+"q4", "messages")).send(Message("6"))
- s3 = p.sender(exchange(prefix+"e4", "messages", prefix+"q4"))
+ p.sender(queue(prefix+"q4", "all")).send(Message("6"))
+ s3 = p.sender(exchange(prefix+"e4", "all", prefix+"q4"))
s3.send(Message("7"))
# Use old connection to unbind
- us = primary.connect_old().session(str(qpid.datatypes.uuid4()))
+ us = primary.connect_old().session(str(uuid4()))
us.exchange_unbind(exchange=prefix+"e4", binding_key="", queue=prefix+"q4")
p.sender(prefix+"e4").send(Message("drop1")) # Should be dropped
# Need a marker so we can wait till sync is done.
@@ -117,9 +171,8 @@ class ShortTests(BrokerTest):
def verify(b, prefix, p):
"""Verify setup was replicated to backup b"""
-
# Wait for configuration to replicate.
- self.wait(b, prefix+"x");
+ wait_address(b, prefix+"x");
self.assert_browse_retry(b, prefix+"q1", ["b", "1", "4"])
self.assertEqual(p.receiver(prefix+"q1").fetch(timeout=0).content, "b")
@@ -127,7 +180,7 @@ class ShortTests(BrokerTest):
self.assert_browse_retry(b, prefix+"q1", ["1", "4"])
self.assert_browse_retry(b, prefix+"q2", []) # configuration only
- self.assert_missing(b, prefix+"q3")
+ assert_missing(b, prefix+"q3")
b.sender(prefix+"e1").send(Message(prefix+"e1")) # Verify binds with replicate=all
self.assert_browse_retry(b, prefix+"q1", ["1", "4", prefix+"e1"])
b.sender(prefix+"e2").send(Message(prefix+"e2")) # Verify binds with replicate=configuration
@@ -147,12 +200,12 @@ class ShortTests(BrokerTest):
setup(p, "2", primary)
# Verify the data on the backup
- b = self.connect_admin(backup).session()
+ b = backup.connect_admin().session()
verify(b, "1", p)
verify(b, "2", p)
# Test a series of messages, enqueue all then dequeue all.
- s = p.sender(queue("foo","messages"))
- self.wait(b, "foo")
+ s = p.sender(queue("foo","all"))
+ wait_address(b, "foo")
msgs = [str(i) for i in range(10)]
for m in msgs: s.send(Message(m))
self.assert_browse_retry(p, "foo", msgs)
@@ -173,16 +226,11 @@ class ShortTests(BrokerTest):
self.assert_browse_retry(p, "foo", msgs[i+1:])
self.assert_browse_retry(b, "foo", msgs[i+1:])
- def qpid_replicate(self, value="messages"):
- return "node:{x-declare:{arguments:{'qpid.replicate':%s}}}" % value
-
def test_sync(self):
- def queue(name, replicate):
- return "%s;{create:always,%s}"%(name, self.qpid_replicate(replicate))
primary = HaBroker(self, name="primary")
primary.promote()
p = primary.connect().session()
- s = p.sender(queue("q","messages"))
+ s = p.sender("q;{create:always}")
for m in [str(i) for i in range(0,10)]: s.send(m)
s.sync()
backup1 = HaBroker(self, name="backup1", broker_url=primary.host_port())
@@ -193,49 +241,39 @@ class ShortTests(BrokerTest):
s.sync()
msgs = [str(i) for i in range(30)]
- b1 = self.connect_admin(backup1).session()
- self.wait(b1, "q");
+ b1 = backup1.connect_admin().session()
+ wait_address(b1, "q");
self.assert_browse_retry(b1, "q", msgs)
- b2 = self.connect_admin(backup2).session()
- self.wait(b2, "q");
+ b2 = backup2.connect_admin().session()
+ wait_address(b2, "q");
self.assert_browse_retry(b2, "q", msgs)
def test_send_receive(self):
"""Verify sequence numbers of messages sent by qpid-send"""
- primary = HaBroker(self, name="primary")
- primary.promote()
- backup1 = HaBroker(self, name="backup1", broker_url=primary.host_port())
- backup2 = HaBroker(self, name="backup2", broker_url=primary.host_port())
+ brokers = HaCluster(self, 3)
sender = self.popen(
["qpid-send",
- "--broker", primary.host_port(),
- "--address", "q;{create:always,%s}"%(self.qpid_replicate("messages")),
+ "--broker", brokers[0].host_port(),
+ "--address", "q;{create:always}",
"--messages=1000",
"--content-string=x"
])
receiver = self.popen(
["qpid-receive",
- "--broker", primary.host_port(),
- "--address", "q;{create:always,%s}"%(self.qpid_replicate("messages")),
+ "--broker", brokers[0].host_port(),
+ "--address", "q;{create:always}",
"--messages=990",
"--timeout=10"
])
- try:
- self.assertEqual(sender.wait(), 0)
- self.assertEqual(receiver.wait(), 0)
- expect = [long(i) for i in range(991, 1001)]
- sn = lambda m: m.properties["sn"]
- self.assert_browse_retry(self.connect_admin(backup1).session(), "q", expect, transform=sn)
- self.assert_browse_retry(self.connect_admin(backup2).session(), "q", expect, transform=sn)
- except:
- print self.browse(primary.connect().session(), "q", transform=sn)
- print self.browse(self.connect_admin(backup1).session(), "q", transform=sn)
- print self.browse(self.connect_admin(backup2).session(), "q", transform=sn)
- raise
+ self.assertEqual(sender.wait(), 0)
+ self.assertEqual(receiver.wait(), 0)
+ expect = [long(i) for i in range(991, 1001)]
+ sn = lambda m: m.properties["sn"]
+ brokers[1].assert_browse_backup("q", expect, transform=sn)
+ brokers[2].assert_browse_backup("q", expect, transform=sn)
def test_failover_python(self):
"""Verify that backups rejects connections and that fail-over works in python client"""
- getLogger().setLevel(ERROR) # Disable WARNING log messages due to failover messages
primary = HaBroker(self, name="primary", expect=EXPECT_EXIT_FAIL)
primary.promote()
backup = HaBroker(self, name="backup", broker_url=primary.host_port())
@@ -245,13 +283,13 @@ class ShortTests(BrokerTest):
self.fail("Expected connection to backup to fail")
except ConnectionError: pass
# Check that admin connections are allowed to backup.
- self.connect_admin(backup).close()
+ backup.connect_admin().close()
# Test discovery: should connect to primary after reject by backup
c = backup.connect(reconnect_urls=[primary.host_port(), backup.host_port()], reconnect=True)
s = c.session()
- sender = s.sender("q;{create:always,%s}"%(self.qpid_replicate()))
- self.wait_backup(backup, "q")
+ sender = s.sender("q;{create:always}")
+ backup.wait_backup("q")
sender.send("foo")
primary.kill()
assert retry(lambda: not is_running(primary.pid))
@@ -265,14 +303,14 @@ class ShortTests(BrokerTest):
primary.promote()
backup = HaBroker(self, name="backup", broker_url=primary.host_port())
url="%s,%s"%(primary.host_port(), backup.host_port())
- primary.connect().session().sender("q;{create:always,%s}"%(self.qpid_replicate()))
- self.wait_backup(backup, "q")
+ primary.connect().session().sender("q;{create:always}")
+ backup.wait_backup("q")
sender = NumberedSender(primary, url=url, queue="q", failover_updates = False)
receiver = NumberedReceiver(primary, url=url, queue="q", failover_updates = False)
receiver.start()
sender.start()
- self.wait_backup(backup, "q")
+ backup.wait_backup("q")
assert retry(lambda: receiver.received > 10) # Wait for some messages to get thru
primary.kill()
@@ -284,19 +322,276 @@ class ShortTests(BrokerTest):
receiver.stop()
def test_backup_failover(self):
- brokers = [ HaBroker(self, name=name, expect=EXPECT_EXIT_FAIL)
- for name in ["a","b","c"] ]
- url = ",".join([b.host_port() for b in brokers])
- for b in brokers: b.set_broker_url(url)
- brokers[0].promote()
- brokers[0].connect().session().sender(
- "q;{create:always,%s}"%(self.qpid_replicate())).send("a")
- for b in brokers[1:]: self.assert_browse_backup(b, "q", ["a"])
- brokers[0].kill()
- brokers[2].promote() # c must fail over to b.
- brokers[2].connect().session().sender("q").send("b")
- self.assert_browse_backup(brokers[1], "q", ["a","b"])
- for b in brokers[1:]: b.kill()
+ """Verify that a backup broker fails over and recovers queue state"""
+ brokers = HaCluster(self, 3)
+ brokers[0].connect().session().sender("q;{create:always}").send("a")
+ for b in brokers[1:]: b.assert_browse_backup("q", ["a"], msg=b)
+ brokers[0].expect = EXPECT_EXIT_FAIL
+ brokers.kill(0)
+ brokers[1].connect().session().sender("q").send("b")
+ brokers[2].assert_browse_backup("q", ["a","b"])
+ s = brokers[1].connect().session()
+ self.assertEqual("a", s.receiver("q").fetch().content)
+ s.acknowledge()
+ brokers[2].assert_browse_backup("q", ["b"])
+
+ def test_qpid_config_replication(self):
+ """Set up replication via qpid-config"""
+ brokers = HaCluster(self,2)
+ brokers[0].config_declare("q","all")
+ brokers[0].connect().session().sender("q").send("foo")
+ brokers[1].assert_browse_backup("q", ["foo"])
+
+ def test_standalone_queue_replica(self):
+ """Test replication of individual queues outside of cluster mode"""
+ primary = HaBroker(self, name="primary", ha_cluster=False)
+ pc = primary.connect()
+ ps = pc.session().sender("q;{create:always}")
+ pr = pc.session().receiver("q;{create:always}")
+ backup = HaBroker(self, name="backup", ha_cluster=False)
+ br = backup.connect().session().receiver("q;{create:always}")
+
+ # Set up replication with qpid-ha
+ backup.replicate(primary.host_port(), "q")
+ ps.send("a")
+ backup.assert_browse_backup("q", ["a"])
+ ps.send("b")
+ backup.assert_browse_backup("q", ["a", "b"])
+ self.assertEqual("a", pr.fetch().content)
+ pr.session.acknowledge()
+ backup.assert_browse_backup("q", ["b"])
+
+ # Set up replication with qpid-config
+ ps2 = pc.session().sender("q2;{create:always}")
+ backup.config_replicate(primary.host_port(), "q2");
+ ps2.send("x")
+ backup.assert_browse_backup("q2", ["x"])
+
+
+ def test_queue_replica_failover(self):
+ """Test individual queue replication from a cluster to a standalone backup broker, verify it fails over."""
+ cluster = HaCluster(self, 2)
+ primary = cluster[0]
+ pc = cluster.connect(0)
+ ps = pc.session().sender("q;{create:always}")
+ pr = pc.session().receiver("q;{create:always}")
+ backup = HaBroker(self, name="backup", ha_cluster=False)
+ br = backup.connect().session().receiver("q;{create:always}")
+ backup.replicate(cluster.url, "q")
+ ps.send("a")
+ backup.assert_browse_backup("q", ["a"])
+ cluster.bounce(0)
+ backup.assert_browse_backup("q", ["a"])
+ ps.send("b")
+ backup.assert_browse_backup("q", ["a", "b"])
+ cluster.bounce(1)
+ self.assertEqual("a", pr.fetch().content)
+ pr.session.acknowledge()
+ backup.assert_browse_backup("q", ["b"])
+
+ def test_lvq(self):
+ """Verify that we replicate to an LVQ correctly"""
+ primary = HaBroker(self, name="primary")
+ primary.promote()
+ backup = HaBroker(self, name="backup", broker_url=primary.host_port())
+ s = primary.connect().session().sender("lvq; {create:always, node:{x-declare:{arguments:{'qpid.last_value_queue_key':lvq-key}}}}")
+ def send(key,value): s.send(Message(content=value,properties={"lvq-key":key}))
+ for kv in [("a","a-1"),("b","b-1"),("a","a-2"),("a","a-3"),("c","c-1"),("c","c-2")]:
+ send(*kv)
+ backup.assert_browse_backup("lvq", ["b-1", "a-3", "c-2"])
+ send("b","b-2")
+ backup.assert_browse_backup("lvq", ["a-3", "c-2", "b-2"])
+ send("c","c-3")
+ backup.assert_browse_backup("lvq", ["a-3", "b-2", "c-3"])
+ send("d","d-1")
+ backup.assert_browse_backup("lvq", ["a-3", "b-2", "c-3", "d-1"])
+
+ def test_ring(self):
+ """Test replication with the ring queue policy"""
+ primary = HaBroker(self, name="primary")
+ primary.promote()
+ backup = HaBroker(self, name="backup", broker_url=primary.host_port())
+ s = primary.connect().session().sender("q; {create:always, node:{x-declare:{arguments:{'qpid.policy_type':ring, 'qpid.max_count':5}}}}")
+ for i in range(10): s.send(Message(str(i)))
+ backup.assert_browse_backup("q", [str(i) for i in range(5,10)])
+
+ def test_reject(self):
+ """Test replication with the reject queue policy"""
+ primary = HaBroker(self, name="primary")
+ primary.promote()
+ backup = HaBroker(self, name="backup", broker_url=primary.host_port())
+ s = primary.connect().session().sender("q; {create:always, node:{x-declare:{arguments:{'qpid.policy_type':reject, 'qpid.max_count':5}}}}")
+ try:
+ for i in range(10): s.send(Message(str(i)), sync=False)
+ except qpid.messaging.exceptions.TargetCapacityExceeded: pass
+ backup.assert_browse_backup("q", [str(i) for i in range(0,5)])
+
+ def test_priority(self):
+ """Verify priority queues replicate correctly"""
+ primary = HaBroker(self, name="primary")
+ primary.promote()
+ backup = HaBroker(self, name="backup", broker_url=primary.host_port())
+ session = primary.connect().session()
+ s = session.sender("priority-queue; {create:always, node:{x-declare:{arguments:{'qpid.priorities':10}}}}")
+ priorities = [8,9,5,1,2,2,3,4,9,7,8,9,9,2]
+ for p in priorities: s.send(Message(priority=p))
+ # Can't use browse_backup as browser sees messages in delivery order not priority.
+ backup.wait_backup("priority-queue")
+ r = backup.connect_admin().session().receiver("priority-queue")
+ received = [r.fetch().priority for i in priorities]
+ self.assertEqual(sorted(priorities, reverse=True), received)
+
+ def test_priority_fairshare(self):
+ """Verify priority queues replicate correctly"""
+ primary = HaBroker(self, name="primary")
+ primary.promote()
+ backup = HaBroker(self, name="backup", broker_url=primary.host_port())
+ session = primary.connect().session()
+ levels = 8
+ priorities = [4,5,3,7,8,8,2,8,2,8,8,16,6,6,6,6,6,6,8,3,5,8,3,5,5,3,3,8,8,3,7,3,7,7,7,8,8,8,2,3]
+ limits={7:0,6:4,5:3,4:2,3:2,2:2,1:2}
+ limit_policy = ",".join(["'qpid.fairshare':5"] + ["'qpid.fairshare-%s':%s"%(i[0],i[1]) for i in limits.iteritems()])
+ s = session.sender("priority-queue; {create:always, node:{x-declare:{arguments:{'qpid.priorities':%s, %s}}}}"%(levels,limit_policy))
+ messages = [Message(content=str(uuid4()), priority = p) for p in priorities]
+ for m in messages: s.send(m)
+ backup.wait_backup(s.target)
+ r = backup.connect_admin().session().receiver("priority-queue")
+ received = [r.fetch().content for i in priorities]
+ sort = sorted(messages, key=lambda m: priority_level(m.priority, levels), reverse=True)
+ fair = [m.content for m in fairshare(sort, lambda l: limits.get(l,0), levels)]
+ self.assertEqual(received, fair)
+
+ def test_priority_ring(self):
+ primary = HaBroker(self, name="primary")
+ primary.promote()
+ backup = HaBroker(self, name="backup", broker_url=primary.host_port())
+ s = primary.connect().session().sender("q; {create:always, node:{x-declare:{arguments:{'qpid.policy_type':ring, 'qpid.max_count':5, 'qpid.priorities':10}}}}")
+ priorities = [8,9,5,1,2,2,3,4,9,7,8,9,9,2]
+ for p in priorities: s.send(Message(priority=p))
+
+ # FIXME aconway 2012-02-22: there is a bug in priority ring
+ # queues that allows a low priority message to displace a high
+ # one. The following commented-out assert_browse is for the
+ # correct result, the uncommented one is for the actualy buggy
+ # result. See https://issues.apache.org/jira/browse/QPID-3866
+ #
+ # backup.assert_browse_backup("q", sorted(priorities,reverse=True)[0:5], transform=lambda m: m.priority)
+ backup.assert_browse_backup("q", [9,9,9,9,2], transform=lambda m: m.priority)
+
+ def test_backup_acquired(self):
+ """Verify that acquired messages are backed up, for all queue types."""
+ class Test:
+ def __init__(self, queue, arguments, expect):
+ self.queue = queue
+ self.address = "%s;{create:always,node:{x-declare:{arguments:{%s}}}}"%(
+ self.queue, ",".join(arguments + ["'qpid.replicate':all"]))
+ self.expect = [str(i) for i in expect]
+
+ def send(self, connection):
+ """Send messages, then acquire one but don't acknowledge"""
+ s = connection.session()
+ for m in range(10): s.sender(self.address).send(str(m))
+ s.receiver(self.address).fetch()
+
+ def wait(self, brokertest, backup):
+ backup.wait_backup(self.queue)
+
+ def verify(self, brokertest, backup):
+ backup.assert_browse_backup(self.queue, self.expect, msg=self.queue)
+
+ tests = [
+ Test("plain",[],range(10)),
+ Test("ring", ["'qpid.policy_type':ring", "'qpid.max_count':5"], range(5,10)),
+ Test("priority",["'qpid.priorities':10"], range(10)),
+ Test("fairshare", ["'qpid.priorities':10,'qpid.fairshare':5"], range(10)),
+ Test("lvq", ["'qpid.last_value_queue_key':lvq-key"], [9])
+ ]
+
+ primary = HaBroker(self, name="primary")
+ primary.promote()
+ backup1 = HaBroker(self, name="backup1", broker_url=primary.host_port())
+ c = primary.connect()
+ for t in tests: t.send(c) # Send messages, leave one unacknowledged.
+
+ backup2 = HaBroker(self, name="backup2", broker_url=primary.host_port())
+ # Wait for backups to catch up.
+ for t in tests:
+ t.wait(self, backup1)
+ t.wait(self, backup2)
+ # Verify acquired message was replicated
+ for t in tests: t.verify(self, backup1)
+ for t in tests: t.verify(self, backup2)
+
+ def test_replicate_default(self):
+ """Make sure we don't replicate if ha-replicate is unspecified or none"""
+ cluster1 = HaCluster(self, 2, ha_replicate=None)
+ c1 = cluster1[0].connect().session().sender("q;{create:always}")
+ cluster2 = HaCluster(self, 2, ha_replicate="none")
+ cluster2[0].connect().session().sender("q;{create:always}")
+ time.sleep(.1) # Give replication a chance.
+ try:
+ cluster1[1].connect_admin().session().receiver("q")
+ self.fail("Excpected no-such-queue exception")
+ except NotFound: pass
+ try:
+ cluster2[1].connect_admin().session().receiver("q")
+ self.fail("Excpected no-such-queue exception")
+ except NotFound: pass
+
+ def test_invalid_default(self):
+ """Verify that a queue with an invalid qpid.replicate gets default treatment"""
+ cluster = HaCluster(self, 2, ha_replicate="all")
+ c = cluster[0].connect().session().sender("q;{create:always, node:{x-declare:{arguments:{'qpid.replicate':XXinvalidXX}}}}")
+ cluster[1].wait_backup("q")
+
+ def test_exclusive_queue(self):
+ """Ensure that we can back-up exclusive queues, i.e. the replicating
+ subscriptions are exempt from the exclusivity"""
+ cluster = HaCluster(self, 2)
+ def test(addr):
+ c = cluster[0].connect()
+ q = addr.split(";")[0]
+ r = c.session().receiver(addr)
+ try: c.session().receiver(addr); self.fail("Expected exclusive exception")
+ except ReceiverError: pass
+ s = c.session().sender(q).send(q)
+ cluster[1].assert_browse_backup(q, [q])
+ test("excl_sub;{create:always, link:{x-subscribe:{exclusive:True}}}");
+ test("excl_queue;{create:always, node:{x-declare:{exclusive:True}}}")
+
+def fairshare(msgs, limit, levels):
+ """
+ Generator to return prioritised messages in expected order for a given fairshare limit
+ """
+ count = 0
+ last_priority = None
+ postponed = []
+ while msgs or postponed:
+ if not msgs:
+ msgs = postponed
+ count = 0
+ last_priority = None
+ postponed = []
+ msg = msgs.pop(0)
+ if last_priority and priority_level(msg.priority, levels) == last_priority:
+ count += 1
+ else:
+ last_priority = priority_level(msg.priority, levels)
+ count = 1
+ l = limit(last_priority)
+ if (l and count > l):
+ postponed.append(msg)
+ else:
+ yield msg
+ return
+
+def priority_level(value, levels):
+ """
+ Method to determine which of a distinct number of priority levels
+ a given value falls into.
+ """
+ offset = 5-math.ceil(levels/2.0)
+ return min(max(value - offset, 0), levels-1)
class LongTests(BrokerTest):
"""Tests that can run for a long time if -DDURATION=<minutes> is set"""
@@ -311,7 +606,7 @@ class LongTests(BrokerTest):
"""Test failover with continuous send-receive"""
# FIXME aconway 2012-02-03: fails due to dropped messages,
# known issue: sending messages to new primary before
- # backups are ready.
+ # backups are ready. Enable when fixed.
# Start a cluster, all members will be killed during the test.
brokers = [ HaBroker(self, name=name, expect=EXPECT_EXIT_FAIL)
@@ -352,4 +647,10 @@ class LongTests(BrokerTest):
if __name__ == "__main__":
shutil.rmtree("brokertest.tmp", True)
- os.execvp("qpid-python-test", ["qpid-python-test", "-m", "ha_tests"] + sys.argv[1:])
+ qpid_ha = os.getenv("QPID_HA_EXEC")
+ if qpid_ha and os.path.exists(qpid_ha):
+ os.execvp("qpid-python-test",
+ ["qpid-python-test", "-m", "ha_tests"] + sys.argv[1:])
+ else:
+ print "Skipping ha_tests, qpid_ha not available"
+
Modified: qpid/branches/asyncstore/cpp/src/tests/install_env.sh.in
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/install_env.sh.in?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/install_env.sh.in (original)
+++ qpid/branches/asyncstore/cpp/src/tests/install_env.sh.in Fri May 4 15:39:19 2012
@@ -23,4 +23,4 @@ prefix=`absdir @prefix@`
export QPID_INSTALL_PREFIX=$prefix
export PATH=$prefix/bin:$prefix/sbin:$prefix/libexec/qpid/tests:$PATH
export LD_LIBRARY_PATH=$prefix/lib:$LD_LIBRARY_PATH
-export PYTHONPATH=$prefix/lib/python2.4/site-packages:$PYTHONPATH
+export PYTHONPATH=$prefix/lib/python2.6/site-packages:$PYTHONPATH
Modified: qpid/branches/asyncstore/cpp/src/tests/ipv6_test
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/ipv6_test?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/ipv6_test (original)
+++ qpid/branches/asyncstore/cpp/src/tests/ipv6_test Fri May 4 15:39:19 2012
@@ -93,10 +93,10 @@ else
BROKER1="[::1]:${PORTS[1]}"
TEST_QUEUE=ipv6-fed-test
- $QPID_CONFIG_EXEC -a $BROKER0 add queue $TEST_QUEUE
- $QPID_CONFIG_EXEC -a $BROKER1 add queue $TEST_QUEUE
+ $QPID_CONFIG_EXEC -b $BROKER0 add queue $TEST_QUEUE
+ $QPID_CONFIG_EXEC -b $BROKER1 add queue $TEST_QUEUE
$QPID_ROUTE_EXEC dynamic add $BROKER1 $BROKER0 amq.direct
- $QPID_CONFIG_EXEC -a $BROKER1 bind amq.direct $TEST_QUEUE $TEST_QUEUE
+ $QPID_CONFIG_EXEC -b $BROKER1 bind amq.direct $TEST_QUEUE $TEST_QUEUE
$QPID_ROUTE_EXEC route map $BROKER1
./datagen --count 100 | tee rdata-in |
@@ -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.
Modified: qpid/branches/asyncstore/cpp/src/tests/logging.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/logging.cpp?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/logging.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/tests/logging.cpp Fri May 4 15:39:19 2012
@@ -29,6 +29,7 @@
#endif
#include <boost/test/floating_point_comparison.hpp>
+#include <boost/algorithm/string/predicate.hpp>
#include <boost/format.hpp>
#include "unit_test.h"
@@ -43,8 +44,10 @@ namespace tests {
QPID_AUTO_TEST_SUITE(loggingTestSuite)
using namespace std;
-using namespace boost;
using namespace qpid::log;
+using boost::ends_with;
+using boost::contains;
+using boost::format;
QPID_AUTO_TEST_CASE(testStatementInit) {
Statement s=QPID_LOG_STATEMENT_INIT(debug); int line=__LINE__;
@@ -176,7 +179,9 @@ QPID_AUTO_TEST_CASE(testLoggerFormat) {
l.format(Logger::FUNCTION);
QPID_LOG(critical, "foo");
- BOOST_CHECK_EQUAL(string(BOOST_CURRENT_FUNCTION) + ": foo\n", out->last());
+ BOOST_CHECK( ends_with( out->last(), ": foo\n"));
+ string name = out->last().substr(0, out->last().length() - 6);
+ BOOST_CHECK( contains( string(BOOST_CURRENT_FUNCTION), name));
l.format(Logger::LEVEL);
QPID_LOG(critical, "foo");
Modified: qpid/branches/asyncstore/cpp/src/tests/python_tests.ps1
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/python_tests.ps1?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/python_tests.ps1 (original)
+++ qpid/branches/asyncstore/cpp/src/tests/python_tests.ps1 Fri May 4 15:39:19 2012
@@ -26,8 +26,7 @@ if (!(Test-Path $PYTHON_DIR -pathType Co
exit 1
}
-$PYTHON_TEST_DIR = "$srcdir\..\..\..\tests\src\py"
-$QMF_LIB = "$srcdir\..\..\..\extras\qmf\src\py"
+. .\test_env.ps1
if (Test-Path env:FAILING) {
$fails = "-I $env:FAILING"
@@ -39,7 +38,5 @@ else {
$tests = "$args"
}
-#cd $PYTHON_DIR
-$env:PYTHONPATH="$PYTHON_DIR;$PYTHON_TEST_DIR;$env:PYTHONPATH;$QMF_LIB"
python $PYTHON_DIR/qpid-python-test -m qpid_tests.broker_0_10 -m qpid.tests -b localhost:$env:QPID_PORT $fails $tests
exit $LASTEXITCODE
Modified: qpid/branches/asyncstore/cpp/src/tests/qpid-cluster-benchmark
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/qpid-cluster-benchmark?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/qpid-cluster-benchmark (original)
+++ qpid/branches/asyncstore/cpp/src/tests/qpid-cluster-benchmark Fri May 4 15:39:19 2012
@@ -22,38 +22,45 @@
# Default options
MESSAGES="-m 10000"
-FLOW="--flow-control 100" # Flow control limit on queue depth for latency.
REPEAT="--repeat 10"
QUEUES="-q 6"
SENDERS="-s 3"
RECEIVERS="-r 3"
BROKERS= # Local broker
CLIENT_HOSTS= # No ssh, all clients are local
+# Connection options
+TCP_NODELAY=false
+RECONNECT=true
+HEARTBEAT=1
-while getopts "m:f:n:b:q:s:r:c:txyv-" opt; do
+while getopts "m:f:n:b:q:s:r:c:h:i:txyv-" opt; do
case $opt in
+ b) BROKERS="-b $OPTARG";;
+ c) CLIENT_HOSTS="-c $OPTARG";;
+ h) HEARTBEAT=$OPTARG;;
+ i) RECONNECT=$OPTARG;;
m) MESSAGES="-m $OPTARG";;
- f) FLOW="--flow-control $OPTARG";;
n) REPEAT="--repeat $OPTARG";;
- b) BROKERS="-b $OPTARG";;
q) QUEUES="-q $OPTARG";;
- s) SENDERS="-s $OPTARG";;
r) RECEIVERS="-r $OPTARG";;
- c) CLIENT_HOSTS="-c $OPTARG";;
- t) TCP_NODELAY="--connection-options {tcp-nodelay:true}";;
+ s) SENDERS="-s $OPTARG";;
+ t) TCP_NODELAY=true;;
+ v) OPTS="--verbose";;
x) SAVE_RECEIVED="--save-received";;
y) NO_DELETE="--no-delete";;
- v) OPTS="--verbose";;
-) break ;;
*) echo "Unknown option"; exit 1;;
esac
done
shift $(($OPTIND-1))
-REPLICATE="node:{x-declare:{arguments:{'qpid.replicate':all}}}"
+CONNECTION_OPTIONS="--connection-options {tcp-nodelay:$TCP_NODELAY,reconnect:$RECONNECT,heartbeat:$HEARTBEAT}"
+CREATE_OPTIONS="node:{x-declare:{arguments:{'qpid.replicate':all}}}"
+
BROKER=$(echo $BROKERS | sed s/,.*//)
run_test() { echo $*; shift; "$@"; echo; echo; echo; }
-OPTS="$OPTS $REPEAT $BROKERS --summarize $QUEUES $SENDERS $RECEIVERS $MESSAGES $CLIENT_HOSTS $SAVE_RECEIVED $TCP_NODELAY $NO_DELETE"
-OPTS="$OPTS --create-option $REPLICATE"
+OPTS="$OPTS $REPEAT $BROKERS --summarize $QUEUES $SENDERS $RECEIVERS $MESSAGES $CLIENT_HOSTS $SAVE_RECEIVED $CONNECTION_OPTIONS $NO_DELETE"
+OPTS="$OPTS --create-option $CREATE_OPTIONS"
+
run_test "Benchmark:" qpid-cpp-benchmark $OPTS "$@"
Modified: qpid/branches/asyncstore/cpp/src/tests/qpid-cpp-benchmark
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/qpid-cpp-benchmark?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/qpid-cpp-benchmark (original)
+++ qpid/branches/asyncstore/cpp/src/tests/qpid-cpp-benchmark Fri May 4 15:39:19 2012
@@ -37,7 +37,7 @@ op.add_option("-r", "--receivers", defau
op.add_option("-m", "--messages", default=100000, type="int", metavar="N",
help="send N messages per sender (default %default)")
op.add_option("--queue-name", default="benchmark", metavar="NAME",
- help="base name for queues (default %default)")
+ help="base name for queues (default %default)")
op.add_option("--send-rate", default=0, metavar="N",
help="send rate limited to N messages/second, 0 means no limit (default %default)")
op.add_option("--receive-rate", default=0, metavar="N",
@@ -67,18 +67,16 @@ op.add_option("--sequence", dest="sequen
action="store_true", help="add a sequence number to each message")
op.add_option("--connection-options", type="str",
help="Connection options for senders & receivers")
-op.add_option("--flow-control", default=0, type="int", metavar="N",
- help="Flow control each sender to limit queue depth to 2*N. 0 means no flow control.")
op.add_option("--durable", default=False, action="store_true",
help="Use durable queues and messages")
op.add_option("--save-received", default=False, action="store_true",
help="Save received message content to files <queuename>-receiver-<n>.msg")
-op.add_option("--group-receivers", default=False, action="store_true",
- help="Run receivers for the same queue on the same host.")
op.add_option("--verbose", default=False, action="store_true",
help="Show commands executed")
op.add_option("--no-delete", default=False, action="store_true",
help="Don't delete the test queues.")
+op.add_option("--fill-drain", default=False, action="store_true",
+ help="First fill the queues, then drain them")
single_quote_re = re.compile("'")
def posix_quote(string):
@@ -150,7 +148,6 @@ def start_send(queue, opts, broker, host
"--report-header=no",
"--timestamp=%s"%(opts.timestamp and "yes" or "no"),
"--sequence=%s"%(opts.sequence and "yes" or "no"),
- "--flow-control", str(opts.flow_control),
"--durable", str(opts.durable)
]
command += opts.send_arg
@@ -169,18 +166,6 @@ def first_line(p):
raise Exception("Process exit %d: %s"%(p.returncode, error_msg(out,err)))
return out.split("\n")[0]
-def queue_exists(queue,broker):
- c = qpid.messaging.Connection(broker)
- c.open()
- try:
- s = c.session()
- try:
- s.sender(queue)
- return True
- except qpid.messaging.exceptions.NotFound:
- return False
- finally: c.close()
-
def recreate_queues(queues, brokers, no_delete, opts):
c = qpid.messaging.Connection(brokers[0])
c.open()
@@ -189,15 +174,9 @@ def recreate_queues(queues, brokers, no_
if not no_delete:
try: s.sender("%s;{delete:always}"%(q)).close()
except qpid.messaging.exceptions.NotFound: pass
- # FIXME aconway 2011-05-04: new cluster async wiring, wait for changes to propagate
- for b in brokers:
- while queue_exists(q,b): time.sleep(0.1);
address = "%s;{%s}"%(q, ",".join(opts.create_option + ["create:always"]))
if opts.verbose: print "Creating", address
s.sender(address)
- # FIXME aconway 2011-05-04: new cluster async wiring, wait for changes to propagate
- for b in brokers:
- while not queue_exists(q,b): time.sleep(0.1);
c.close()
def print_header(timestamp):
@@ -295,24 +274,32 @@ def main():
recreate_queues(queues, opts.broker, opts.no_delete, opts)
ready_receiver = ReadyReceiver(ready_queue, opts.broker[0])
- if opts.group_receivers: # Run receivers for same queue against same broker.
- receivers = []
- for q in queues:
- b = brokers.next()
- for j in xrange(opts.receivers):
- receivers.append(
- start_receive(q, j, opts, ready_queue, b, client_hosts.next()))
- else: # Don't group receivers
- receivers = [start_receive(q, j, opts, ready_queue,
- brokers.next(), client_hosts.next())
- for q in queues for j in xrange(opts.receivers)]
-
- ready_receiver.wait(filter(None, receivers)) # Wait for receivers to be ready.
- start = time.time()
- senders = [start_send(q, opts,brokers.next(), client_hosts.next())
- for q in queues for j in xrange(opts.senders)]
+ def start_receivers():
+ return [ start_receive(q, j, opts, ready_queue, brokers.next(), client_hosts.next())
+ for q in queues for j in xrange(opts.receivers) ]
+
+
+ def start_senders():
+ return [ start_send(q, opts,brokers.next(), client_hosts.next())
+ for q in queues for j in xrange(opts.senders) ]
+
if opts.report_header and i == 0: print_header(opts.timestamp)
- for p in senders + receivers: p.wait()
+
+ if opts.fill_drain:
+ # First fill the queues, then drain them
+ start = time.time()
+ senders = start_senders()
+ for p in senders: p.wait()
+ receivers = start_receivers()
+ for p in receivers: p.wait()
+ else:
+ # Run senders and receivers in parallel
+ receivers = start_receivers()
+ ready_receiver.wait(filter(None, receivers)) # Wait for receivers ready
+ start = time.time()
+ senders = start_senders()
+ for p in senders + receivers: p.wait()
+
total_sent = opts.queues * opts.senders * opts.messages
total_tp = total_sent / (time.time()-start)
send_stats=parse_senders(senders)
Modified: qpid/branches/asyncstore/cpp/src/tests/qpid-perftest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/qpid-perftest.cpp?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/qpid-perftest.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/tests/qpid-perftest.cpp Fri May 4 15:39:19 2012
@@ -85,6 +85,7 @@ struct Opts : public TestOptions {
size_t pubs;
size_t count ;
size_t size;
+ size_t headers;
bool confirm;
bool durable;
bool uniqueData;
@@ -112,7 +113,7 @@ struct Opts : public TestOptions {
Opts() :
TestOptions(helpText),
setup(false), control(false), publish(false), subscribe(false), baseName("qpid-perftest"),
- pubs(1), count(500000), size(1024), confirm(true), durable(false), uniqueData(false), syncPub(false),
+ pubs(1), count(500000), size(1024), headers(0), confirm(true), durable(false), uniqueData(false), syncPub(false),
subs(1), ack(0),
qt(1),singleConnect(false), iterations(1), mode(SHARED), summary(false),
intervalSub(0), intervalPub(0), tx(0), txPub(0), txSub(0), commitAsync(false)
@@ -131,6 +132,7 @@ struct Opts : public TestOptions {
("npubs", optValue(pubs, "N"), "Create N publishers.")
("count", optValue(count, "N"), "Each publisher sends N messages.")
("size", optValue(size, "BYTES"), "Size of messages in bytes.")
+ ("headers", optValue(headers, "N"), "Number of headers to add to each message.")
("pub-confirm", optValue(confirm, "yes|no"), "Publisher use confirm-mode.")
("durable", optValue(durable, "yes|no"), "Publish messages as durable.")
("unique-data", optValue(uniqueData, "yes|no"), "Make data for each message unique.")
@@ -503,7 +505,13 @@ struct PublishThread : public Client {
Message msg(data, routingKey);
if (opts.durable)
msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT);
-
+ if (opts.headers) {
+ for (size_t i = 0; i < opts.headers; ++i) {
+ std::stringstream h;
+ h << "hdr" << i;
+ msg.getMessageProperties().getApplicationHeaders().setString(h.str(), h.str());
+ }
+ }
if (opts.txPub){
session.txSelect();
Modified: qpid/branches/asyncstore/cpp/src/tests/qpid-ping.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/qpid-ping.cpp?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/qpid-ping.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/tests/qpid-ping.cpp Fri May 4 15:39:19 2012
@@ -32,11 +32,20 @@
#include <string>
#include <iostream>
-using namespace std;
-using namespace qpid::sys;
-using namespace qpid::framing;
-using namespace qpid::client;
-using namespace qpid;
+using std::cerr;
+using std::cout;
+using std::endl;
+using std::exception;
+using std::string;
+using namespace qpid::client::arg; // For keyword args
+using qpid::client::AsyncSession;
+using qpid::client::Connection;
+using qpid::client::Message;
+using qpid::client::SubscriptionManager;
+using qpid::framing::Uuid;
+
+namespace qpid {
+namespace tests {
struct PingOptions : public qpid::TestOptions {
int timeout; // Timeout in seconds.
@@ -48,9 +57,11 @@ struct PingOptions : public qpid::TestOp
}
};
+}} // namespace qpid::tests
+
int main(int argc, char** argv) {
try {
- PingOptions opts;
+ qpid::tests::PingOptions opts;
opts.parse(argc, argv);
opts.con.heartbeat = (opts.timeout+1)/2;
Connection connection;
@@ -58,8 +69,8 @@ int main(int argc, char** argv) {
if (!opts.quiet) cout << "Opened connection." << endl;
AsyncSession s = connection.newSession();
string qname(Uuid(true).str());
- s.queueDeclare(arg::queue=qname,arg::autoDelete=true,arg::exclusive=true);
- s.messageTransfer(arg::content=Message("hello", qname));
+ s.queueDeclare(queue=qname, autoDelete=true, exclusive=true);
+ s.messageTransfer(content=Message("hello", qname));
if (!opts.quiet) cout << "Sent message." << endl;
SubscriptionManager subs(s);
subs.get(qname);
Modified: qpid/branches/asyncstore/cpp/src/tests/qpid-send.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/qpid-send.cpp?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/qpid-send.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/tests/qpid-send.cpp Fri May 4 15:39:19 2012
@@ -36,15 +36,26 @@
#include <iostream>
#include <memory>
-using namespace std;
-using namespace qpid::messaging;
-using namespace qpid::types;
+using std::string;
+using std::ios_base;
-typedef std::vector<std::string> string_vector;
+using qpid::messaging::Address;
+using qpid::messaging::Connection;
+using qpid::messaging::Duration;
+using qpid::messaging::FailoverUpdates;
+using qpid::messaging::Message;
+using qpid::messaging::Receiver;
+using qpid::messaging::Session;
+using qpid::messaging::Sender;
+using qpid::types::Exception;
+using qpid::types::Uuid;
+using qpid::types::Variant;
namespace qpid {
namespace tests {
+typedef std::vector<std::string> string_vector;
+
struct Options : public qpid::Options
{
bool help;
@@ -74,7 +85,6 @@ struct Options : public qpid::Options
uint reportEvery;
bool reportHeader;
uint sendRate;
- uint flowControl;
bool sequence;
bool timestamp;
std::string groupKey;
@@ -104,7 +114,6 @@ struct Options : public qpid::Options
reportEvery(0),
reportHeader(true),
sendRate(0),
- flowControl(0),
sequence(true),
timestamp(true),
groupPrefix("GROUP-"),
@@ -138,7 +147,6 @@ struct Options : public qpid::Options
("report-every", qpid::optValue(reportEvery,"N"), "Report throughput statistics every N messages")
("report-header", qpid::optValue(reportHeader, "yes|no"), "Headers on report.")
("send-rate", qpid::optValue(sendRate,"N"), "Send at rate of N messages/second. 0 means send as fast as possible.")
- ("flow-control", qpid::optValue(flowControl,"N"), "Do end to end flow control to limit queue depth to 2*N. 0 means no flow control.")
("sequence", qpid::optValue(sequence, "yes|no"), "Add a sequence number messages property (required for duplicate/lost message detection)")
("timestamp", qpid::optValue(timestamp, "yes|no"), "Add a time stamp messages property (required for latency measurement)")
("group-key", qpid::optValue(groupKey, "KEY"), "Generate groups of messages using message header 'KEY' to hold the group identifier")
@@ -223,10 +231,6 @@ const string EOS("eos");
const string SN("sn");
const string TS("ts");
-}} // namespace qpid::tests
-
-using namespace qpid::tests;
-
class ContentGenerator {
public:
virtual ~ContentGenerator() {}
@@ -329,6 +333,20 @@ public:
}
};
+}} // namespace qpid::tests
+
+using qpid::tests::Options;
+using qpid::tests::Reporter;
+using qpid::tests::Throughput;
+using qpid::tests::ContentGenerator;
+using qpid::tests::GroupGenerator;
+using qpid::tests::GetlineContentGenerator;
+using qpid::tests::MapContentGenerator;
+using qpid::tests::FixedContentGenerator;
+using qpid::tests::SN;
+using qpid::tests::TS;
+using qpid::tests::EOS;
+
int main(int argc, char ** argv)
{
Connection connection;
@@ -350,8 +368,6 @@ int main(int argc, char ** argv)
msg.setPriority(opts.priority);
}
if (!opts.replyto.empty()) {
- if (opts.flowControl)
- throw Exception("Can't use reply-to and flow-control together");
msg.setReplyTo(Address(opts.replyto));
}
if (!opts.userid.empty()) msg.setUserId(opts.userid);
@@ -385,26 +401,10 @@ int main(int argc, char ** argv)
int64_t interval = 0;
if (opts.sendRate) interval = qpid::sys::TIME_SEC/opts.sendRate;
- Receiver flowControlReceiver;
- Address flowControlAddress("flow-"+Uuid(true).str()+";{create:always,delete:always}");
- uint flowSent = 0;
- if (opts.flowControl) {
- flowControlReceiver = session.createReceiver(flowControlAddress);
- flowControlReceiver.setCapacity(2);
- }
-
while (contentGen->setContent(msg)) {
++sent;
if (opts.sequence)
msg.getProperties()[SN] = sent;
- if (opts.flowControl) {
- if ((sent % opts.flowControl) == 0) {
- msg.setReplyTo(flowControlAddress);
- ++flowSent;
- }
- else
- msg.setReplyTo(Address()); // Clear the reply address.
- }
if (groupGen.get())
groupGen->setGroupInfo(msg);
@@ -423,19 +423,12 @@ int main(int argc, char ** argv)
}
if (opts.messages && sent >= opts.messages) break;
- if (opts.flowControl && flowSent == 2) {
- flowControlReceiver.get(Duration::SECOND);
- --flowSent;
- }
-
if (opts.sendRate) {
qpid::sys::AbsTime waitTill(start, sent*interval);
int64_t delay = qpid::sys::Duration(qpid::sys::now(), waitTill);
if (delay > 0) qpid::sys::usleep(delay/qpid::sys::TIME_USEC);
}
}
- for ( ; flowSent>0; --flowSent)
- flowControlReceiver.get(Duration::SECOND);
if (opts.reportTotal) reporter.report();
for (uint i = opts.sendEos; i > 0; --i) {
if (opts.sequence)
Modified: qpid/branches/asyncstore/cpp/src/tests/qpid-txtest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/qpid-txtest.cpp?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/qpid-txtest.cpp (original)
+++ qpid/branches/asyncstore/cpp/src/tests/qpid-txtest.cpp Fri May 4 15:39:19 2012
@@ -33,6 +33,7 @@
#include "qpid/client/SubscriptionManager.h"
#include "qpid/framing/Array.h"
#include "qpid/framing/Buffer.h"
+#include "qpid/framing/FieldValue.h"
#include "qpid/framing/Uuid.h"
#include "qpid/sys/Thread.h"
@@ -245,10 +246,10 @@ struct Controller : public Client
// Recover DTX transactions (if any)
if (opts.dtx) {
- std::vector<std::string> inDoubtXids;
framing::DtxRecoverResult dtxRes = session.dtxRecover().get();
const framing::Array& xidArr = dtxRes.getInDoubt();
- xidArr.collect(inDoubtXids);
+ std::vector<std::string> inDoubtXids(xidArr.size());
+ std::transform(xidArr.begin(), xidArr.end(), inDoubtXids.begin(), framing::Array::get<std::string, framing::Array::ValuePtr>);
if (inDoubtXids.size()) {
if (!opts.quiet) std::cout << "Recovering DTX in-doubt transaction(s):" << std::endl;
Modified: qpid/branches/asyncstore/cpp/src/tests/queue_flow_limit_tests.py
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/queue_flow_limit_tests.py?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/queue_flow_limit_tests.py (original)
+++ qpid/branches/asyncstore/cpp/src/tests/queue_flow_limit_tests.py Fri May 4 15:39:19 2012
@@ -117,7 +117,7 @@ class QueueFlowLimitTests(TestBase010):
tool = environ.get("QPID_CONFIG_EXEC")
if tool:
command = tool + \
- " --broker-addr=%s:%s " % (self.broker.host, self.broker.port) \
+ " --broker=%s:%s " % (self.broker.host, self.broker.port) \
+ "add queue test01 --flow-stop-count=999" \
+ " --flow-resume-count=55 --flow-stop-size=5000000" \
+ " --flow-resume-size=100000"
Modified: qpid/branches/asyncstore/cpp/src/tests/reliable_replication_test
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/reliable_replication_test?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/reliable_replication_test (original)
+++ qpid/branches/asyncstore/cpp/src/tests/reliable_replication_test Fri May 4 15:39:19 2012
@@ -47,12 +47,12 @@ setup() {
echo "Testing replication from port $BROKER_A to port $BROKER_B"
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add exchange replication replication
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add exchange replication replication
$PYTHON_COMMANDS/qpid-route --ack 500 queue add "localhost:$BROKER_B" "localhost:$BROKER_A" replication replication
#create test queue (only replicate enqueues for this test):
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue queue-a --generate-queue-events 1
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add queue queue-a
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue queue-a --generate-queue-events 1
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add queue queue-a
}
send() {
Modified: qpid/branches/asyncstore/cpp/src/tests/replication_test
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/replication_test?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/replication_test (original)
+++ qpid/branches/asyncstore/cpp/src/tests/replication_test Fri May 4 15:39:19 2012
@@ -46,21 +46,21 @@ if test -d ${PYTHON_DIR} && test -f "$RE
BROKER_B=`cat qpidd.port`
echo "Running replication test between localhost:$BROKER_A and localhost:$BROKER_B"
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add exchange replication replication
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add exchange replication replication
$PYTHON_COMMANDS/qpid-route --ack 5 queue add "localhost:$BROKER_B" "localhost:$BROKER_A" replication replication
#create test queues
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue queue-a --generate-queue-events 2
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue queue-b --generate-queue-events 2
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue queue-c --generate-queue-events 1
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue queue-d --generate-queue-events 2
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue queue-e --generate-queue-events 1
-
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add queue queue-a
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add queue queue-b
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add queue queue-c
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add queue queue-e
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue queue-a --generate-queue-events 2
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue queue-b --generate-queue-events 2
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue queue-c --generate-queue-events 1
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue queue-d --generate-queue-events 2
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue queue-e --generate-queue-events 1
+
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add queue queue-a
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add queue queue-b
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add queue queue-c
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add queue queue-e
#queue-d deliberately not declared on DR; this error case should be handled
#publish and consume from test queues on broker A:
@@ -124,13 +124,13 @@ if test -d ${PYTHON_DIR} && test -f "$RE
$QPIDD_EXEC --daemon --port 0 --no-data-dir --no-module-dir --auth no --load-module $REPLICATION_EXCHANGE_LIB --log-enable info+ --log-to-file replication-dest.log --log-to-stderr 0 > qpidd.port
BROKER_B=`cat qpidd.port`
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add exchange replication replication
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add exchange replication replication
$PYTHON_COMMANDS/qpid-route --ack 5 queue add "localhost:$BROKER_B" "localhost:$BROKER_A" replication replication
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue queue-e --generate-queue-events 2
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add queue queue-e
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_A" add queue queue-d --generate-queue-events 1
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add queue queue-d
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue queue-e --generate-queue-events 2
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add queue queue-e
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_A" add queue queue-d --generate-queue-events 1
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add queue queue-d
i=1
while [ $i -le 10 ]; do
@@ -152,8 +152,8 @@ if test -d ${PYTHON_DIR} && test -f "$RE
$QPIDD_EXEC --daemon --port 0 --no-data-dir --no-module-dir --auth no --load-module $REPLICATION_EXCHANGE_LIB --log-enable info+ --log-to-file replication-dest.log --log-to-stderr 0 > qpidd.port
BROKER_B=`cat qpidd.port`
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add queue queue-e
- $PYTHON_COMMANDS/qpid-config -a "localhost:$BROKER_B" add exchange replication replication
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add queue queue-e
+ $PYTHON_COMMANDS/qpid-config -b "localhost:$BROKER_B" add exchange replication replication
$PYTHON_COMMANDS/qpid-route --ack 5 queue add "localhost:$BROKER_B" "localhost:$BROKER_A" replication replication
# now send another 15
i=11
Modified: qpid/branches/asyncstore/cpp/src/tests/ring_queue_test
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/ring_queue_test?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/ring_queue_test (original)
+++ qpid/branches/asyncstore/cpp/src/tests/ring_queue_test Fri May 4 15:39:19 2012
@@ -28,7 +28,7 @@ MESSAGES=10000
SENDERS=1
RECEIVERS=1
CONCURRENT=0
-BROKER_URL="-a ${QPID_BROKER:-localhost}:${QPID_PORT:-5672}"
+BROKER_URL="-b ${QPID_BROKER:-localhost}:${QPID_PORT:-5672}"
setup() {
if [[ $DURABLE -gt 0 ]]; then
Modified: qpid/branches/asyncstore/cpp/src/tests/run_acl_tests
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_acl_tests?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_acl_tests (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_acl_tests Fri May 4 15:39:19 2012
@@ -22,23 +22,31 @@
# Run the acl tests. $srcdir is set by the Makefile.
source ./test_env.sh
DATA_DIR=`pwd`/data_dir
+DATA_DIRI=`pwd`/data_diri
+DATA_DIRU=`pwd`/data_diru
trap stop_brokers INT TERM QUIT
start_brokers() {
- ../qpidd --daemon --port 0 --no-module-dir --data-dir $DATA_DIR --load-module $ACL_LIB --acl-file policy.acl --auth no > qpidd.port
+ ../qpidd --daemon --port 0 --no-module-dir --data-dir $DATA_DIR --load-module $ACL_LIB --acl-file policy.acl --auth no --log-to-file local.log > qpidd.port
LOCAL_PORT=`cat qpidd.port`
+ ../qpidd --daemon --port 0 --no-module-dir --data-dir $DATA_DIRI --load-module $ACL_LIB --acl-file policy.acl --auth no --acl-max-connect-per-ip 2 --log-to-file locali.log > qpiddi.port
+ LOCAL_PORTI=`cat qpiddi.port`
+ ../qpidd --daemon --port 0 --no-module-dir --data-dir $DATA_DIRU --load-module $ACL_LIB --acl-file policy.acl --auth no --acl-max-connect-per-user 2 --log-to-file localu.log > qpiddu.port
+ LOCAL_PORTU=`cat qpiddu.port`
}
stop_brokers() {
$QPIDD_EXEC --no-module-dir -q --port $LOCAL_PORT
+ $QPIDD_EXEC --no-module-dir -q --port $LOCAL_PORTI
+ $QPIDD_EXEC --no-module-dir -q --port $LOCAL_PORTU
}
test_loading_acl_from_absolute_path(){
POLICY_FILE=$srcdir/policy.acl
rm -f temp.log
PORT=`../qpidd --daemon --port 0 --no-module-dir --no-data-dir --auth no --load-module $ACL_LIB --acl-file $POLICY_FILE -t --log-to-file temp.log 2>/dev/null`
- ACL_FILE=`grep "notice Read ACL file" temp.log | sed 's/^.*Read ACL file //'`
+ ACL_FILE=`grep "notice ACL: Read file" temp.log | sed 's/^.*Read file //'`
$QPIDD_EXEC --no-module-dir -q --port $PORT
if test "$ACL_FILE" != "\"$POLICY_FILE\""; then
echo "unable to load policy file from an absolute path";
@@ -49,14 +57,22 @@ test_loading_acl_from_absolute_path(){
if test -d ${PYTHON_DIR} ; then
rm -rf $DATA_DIR
+ rm -rf $DATA_DIRI
+ rm -rf $DATA_DIRU
mkdir -p $DATA_DIR
+ mkdir -p $DATA_DIRI
+ mkdir -p $DATA_DIRU
cp $srcdir/policy.acl $DATA_DIR
+ cp $srcdir/policy.acl $DATA_DIRI
+ cp $srcdir/policy.acl $DATA_DIRU
start_brokers
- echo "Running acl tests using brokers on ports $LOCAL_PORT"
- $QPID_PYTHON_TEST -b localhost:$LOCAL_PORT -m acl || EXITCODE=1
+ echo "Running acl tests using brokers on ports $LOCAL_PORT, $LOCAL_PORTI, and $LOCAL_PORTU"
+ $QPID_PYTHON_TEST -b localhost:$LOCAL_PORT -m acl -Dport-i=$LOCAL_PORTI -Dport-u=$LOCAL_PORTU || EXITCODE=1
stop_brokers || EXITCODE=1
test_loading_acl_from_absolute_path || EXITCODE=1
rm -rf $DATA_DIR
+ rm -rf $DATA_DIRI
+ rm -rf $DATA_DIRU
exit $EXITCODE
fi
Modified: qpid/branches/asyncstore/cpp/src/tests/run_acl_tests.ps1
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_acl_tests.ps1?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_acl_tests.ps1 (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_acl_tests.ps1 Fri May 4 15:39:19 2012
@@ -20,15 +20,12 @@
# Run the acl tests.
$srcdir = Split-Path $myInvocation.InvocationName
-$PYTHON_DIR = "$srcdir\..\..\..\python"
+. .\test_env.ps1
if (!(Test-Path $PYTHON_DIR -pathType Container)) {
"Skipping acl tests as python libs not found"
exit 1
}
-$PYTHON_TEST_DIR = "$srcdir\..\..\..\tests\src\py"
-$QMF_LIB = "$srcdir\..\..\..\extras\qmf\src\py"
-$env:PYTHONPATH="$PYTHON_DIR;$srcdir;$PYTHON_TEST_DIR;$QMF_LIB"
$Global:BROKER_EXE = ""
Function start_broker($acl_options)
Modified: qpid/branches/asyncstore/cpp/src/tests/run_cli_tests
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_cli_tests?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_cli_tests (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_cli_tests Fri May 4 15:39:19 2012
@@ -56,9 +56,9 @@ start_brokers() {
targs="--ignore=*xml*"
fi
- ../qpidd --daemon --port 0 --no-data-dir --no-module-dir --auth no $xargs > qpidd.port
+ ../qpidd --daemon --port 0 --no-data-dir --no-module-dir --mgmt-publish no --auth no $xargs > qpidd.port
LOCAL_PORT=`cat qpidd.port`
- ../qpidd --daemon --port 0 --no-data-dir --no-module-dir --auth no $xargs > qpidd.port
+ ../qpidd --daemon --port 0 --no-data-dir --no-module-dir --mgmt-publish no --auth no $xargs > qpidd.port
REMOTE_PORT=`cat qpidd.port`
}
Modified: qpid/branches/asyncstore/cpp/src/tests/run_cluster_authentication_soak
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_cluster_authentication_soak?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_cluster_authentication_soak (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_cluster_authentication_soak Fri May 4 15:39:19 2012
@@ -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
Modified: qpid/branches/asyncstore/cpp/src/tests/run_cluster_authentication_test
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_cluster_authentication_test?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_cluster_authentication_test (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_cluster_authentication_test Fri May 4 15:39:19 2012
@@ -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
Modified: qpid/branches/asyncstore/cpp/src/tests/run_cluster_test
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_cluster_test?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_cluster_test (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_cluster_test Fri May 4 15:39:19 2012
@@ -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
Modified: qpid/branches/asyncstore/cpp/src/tests/run_cluster_tests
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_cluster_tests?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_cluster_tests (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_cluster_tests Fri May 4 15:39:19 2012
@@ -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; }
Modified: qpid/branches/asyncstore/cpp/src/tests/run_failover_soak
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_failover_soak?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_failover_soak (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_failover_soak Fri May 4 15:39:19 2012
@@ -20,7 +20,8 @@
#
source ./test_env.sh
-. $srcdir/ais_check
+source cpg_check.sh
+cpg_enabled || exit 0
host=127.0.0.1
Modified: qpid/branches/asyncstore/cpp/src/tests/run_federation_sys_tests
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/cpp/src/tests/run_federation_sys_tests?rev=1334037&r1=1334036&r2=1334037&view=diff
==============================================================================
--- qpid/branches/asyncstore/cpp/src/tests/run_federation_sys_tests (original)
+++ qpid/branches/asyncstore/cpp/src/tests/run_federation_sys_tests Fri May 4 15:39:19 2012
@@ -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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org