diff options
Diffstat (limited to 'qpid/cpp/src/tests/replication_test')
-rwxr-xr-x | qpid/cpp/src/tests/replication_test | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/qpid/cpp/src/tests/replication_test b/qpid/cpp/src/tests/replication_test index 6e0c1c8d3b..8b3022b260 100755 --- a/qpid/cpp/src/tests/replication_test +++ b/qpid/cpp/src/tests/replication_test @@ -56,10 +56,12 @@ if test -d ${PYTHON_DIR} && test -f ../.libs/replicating_listener.so && test -f $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_A" add queue queue-b --generate-queue-events 2 $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_A" add queue queue-c --generate-queue-events 1 $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_A" add queue queue-d --generate-queue-events 2 + $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_A" add queue queue-e --generate-queue-events 1 $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_B" add queue queue-a $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_B" add queue queue-b $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_B" add queue queue-c + $PYTHON_DIR/commands/qpid-config -a "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: @@ -89,6 +91,12 @@ if test -d ${PYTHON_DIR} && test -f ../.libs/replicating_listener.so && test -f ./receiver --port $BROKER_A --queue queue-c --messages 10 > /dev/null ./receiver --port $BROKER_A --queue queue-d > /dev/null + + # What we are doing is putting a message on the end of repliaction queue & waiting for it on remote side + # making sure all the messages have been flushed from the replication queue. + echo dummy | ./sender --port $BROKER_A --routing-key queue-e --send-eos 1 + ./receiver --port $BROKER_B --queue queue-e --messages 1 > /dev/null + #shutdown broker A then check that broker Bs versions of the queues are as expected ../qpidd -q --port $BROKER_A unset BROKER_A @@ -98,7 +106,6 @@ if test -d ${PYTHON_DIR} && test -f ../.libs/replicating_listener.so && test -f ./receiver --port $BROKER_B --queue queue-b > queue-b-backup.repl ./receiver --port $BROKER_B --queue queue-c > queue-c-backup.repl - stop_brokers tail -5 queue-a-input.repl > queue-a-expected.repl tail -10 queue-b-input.repl > queue-b-expected.repl @@ -108,6 +115,60 @@ if test -d ${PYTHON_DIR} && test -f ../.libs/replicating_listener.so && test -f grep 'queue-d does not exist' replication-dest.log > /dev/null || echo "WARNING: Expected error to be logged!" + stop_brokers + + # now check offsets working (enqueue based on position being set, not queue abs position) + + ../qpidd --daemon --port 0 --no-data-dir --no-module-dir --auth no --load-module ../.libs/replicating_listener.so --replication-queue replication --create-replication-queue true --log-enable info+ --log-to-file replication-source.log --log-to-stderr 0 > qpidd.port + BROKER_A=`cat qpidd.port` + + ../qpidd --daemon --port 0 --no-data-dir --no-module-dir --auth no --load-module ../.libs/replication_exchange.so --log-enable info+ --log-to-file replication-dest.log --log-to-stderr 0 > qpidd.port + BROKER_B=`cat qpidd.port` + + $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_B" add exchange replication replication + $PYTHON_DIR/commands/qpid-route --ack 5 queue add "localhost:$BROKER_B" "localhost:$BROKER_A" replication replication + + $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_A" add queue queue-e --generate-queue-events 2 + $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_B" add queue queue-e + $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_A" add queue queue-d --generate-queue-events 1 + $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_B" add queue queue-d + + i=1 + while [ $i -le 10 ]; do + echo Message $i for A >> queue-e-input.repl + i=`expr $i + 1` + done + + ./sender --port $BROKER_A --routing-key queue-e --send-eos 1 < queue-e-input.repl + ./receiver --port $BROKER_A --queue queue-e --messages 10 > /dev/null + + # What we are doing is putting a message on the end of repliaction queue & waiting for it on remote side + # making sure all the messages have been flushed from the replication queue. + echo dummy | ./sender --port $BROKER_A --routing-key queue-d --send-eos 1 + ./receiver --port $BROKER_B --queue queue-d --messages 1 > /dev/null + + # now check offsets working + ../qpidd -q --port $BROKER_B + unset BROKER_B + ../qpidd --daemon --port 0 --no-data-dir --no-module-dir --auth no --load-module ../.libs/replication_exchange.so --log-enable info+ --log-to-file replication-dest.log --log-to-stderr 0 > qpidd.port + BROKER_B=`cat qpidd.port` + + $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_B" add queue queue-e + $PYTHON_DIR/commands/qpid-config -a "localhost:$BROKER_B" add exchange replication replication + $PYTHON_DIR/commands/qpid-route --ack 5 queue add "localhost:$BROKER_B" "localhost:$BROKER_A" replication replication + # now send another 15 + i=11 + while [ $i -le 15 ]; do + echo Message $i for A >> queue-e1-input.repl + i=`expr $i + 1` + done + ./sender --port $BROKER_A --routing-key queue-e --send-eos 1 < queue-e1-input.repl + + ./receiver --port $BROKER_B --queue queue-e > queue-e-backup.repl + diff queue-e-backup.repl queue-e1-input.repl || FAIL=1 + + stop_brokers + if [ x$FAIL != x ]; then echo replication test failed: expectations not met! exit 1 |