Skip to content

Commit 3715015

Browse files
author
Tim Watson
committed
merge bug25163
2 parents ef9c6ff + b99a67a commit 3715015

File tree

5 files changed

+86
-4
lines changed

5 files changed

+86
-4
lines changed

build.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
</fail>
309309
</target>
310310

311-
<target name="test-suite-run" depends="test-client, test-ssl, test-server, test-functional, test-main-silent"/>
311+
<target name="test-suite-run" depends="test-client, test-ssl, test-server, test-functional, test-functional-and-server-with-ha, test-main-silent"/>
312312

313313
<target name="test-client" depends="test-build" description="Run the client test suites.">
314314
<junit printSummary="withOutAndErr"
@@ -369,6 +369,19 @@
369369
</junit>
370370
</target>
371371

372+
<!-- TODO: merge test-server, test-functional and this into one, once umbrellas have been merged -->
373+
<target name="test-functional-and-server-with-ha" depends="detect-umbrella, test-build" if="UMBRELLA_AVAILABLE">
374+
<junit printSummary="withOutAndErr"
375+
haltOnFailure="${haltOnFailureJunit}"
376+
failureproperty="test.failure"
377+
fork="yes">
378+
<classpath refid="test.classpath"/>
379+
<formatter type="plain"/>
380+
<formatter type="xml"/>
381+
<test todir="${build.out}" name="com.rabbitmq.client.test.server.HATests"/>
382+
</junit>
383+
</target>
384+
372385
<target name="test-single" depends="test-build">
373386
<junit printSummary="withOutAndErr"
374387
haltOnFailure="${haltOnFailureJunit}"

test/src/com/rabbitmq/client/test/functional/FunctionalTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
public class FunctionalTests extends TestCase {
2727
public static TestSuite suite() {
2828
TestSuite suite = new TestSuite("functional");
29+
add(suite);
30+
return suite;
31+
}
32+
33+
public static void add(TestSuite suite) {
2934
suite.addTestSuite(ConnectionOpen.class);
3035
suite.addTestSuite(Heartbeat.class);
3136
suite.addTestSuite(Tables.class);
@@ -64,6 +69,5 @@ public static TestSuite suite() {
6469
suite.addTestSuite(InternalExchange.class);
6570
suite.addTestSuite(CcRoutes.class);
6671
suite.addTestSuite(WorkPoolTests.class);
67-
return suite;
6872
}
6973
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// The contents of this file are subject to the Mozilla Public License
2+
// Version 1.1 (the "License"); you may not use this file except in
3+
// compliance with the License. You may obtain a copy of the License
4+
// at http://www.mozilla.org/MPL/
5+
//
6+
// Software distributed under the License is distributed on an "AS IS"
7+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
8+
// the License for the specific language governing rights and
9+
// limitations under the License.
10+
//
11+
// The Original Code is RabbitMQ.
12+
//
13+
// The Initial Developer of the Original Code is VMware, Inc.
14+
// Copyright (c) 2007-2012 VMware, Inc. All rights reserved.
15+
//
16+
17+
package com.rabbitmq.client.test.server;
18+
19+
import com.rabbitmq.client.test.functional.FunctionalTests;
20+
import com.rabbitmq.tools.Host;
21+
import junit.framework.TestCase;
22+
import junit.framework.TestSuite;
23+
24+
public class HATests extends TestSuite {
25+
public static boolean HA_TESTS_RUNNING = false;
26+
27+
public static TestSuite suite() {
28+
TestSuite suite = new TestSuite("server-tests");
29+
suite.addTestSuite(SetUp.class);
30+
FunctionalTests.add(suite);
31+
ServerTests.add(suite);
32+
suite.addTestSuite(TearDown.class);
33+
return suite;
34+
}
35+
36+
// This is of course an abuse of the TestCase concept - but I don't want to
37+
// run this command on every test case. And there's no hook for "before /
38+
// after this test suite".
39+
public static class SetUp extends TestCase {
40+
@Override
41+
protected void setUp() throws Exception {
42+
Host.executeCommand("cd ../rabbitmq-test; make enable-ha");
43+
HA_TESTS_RUNNING = true;
44+
}
45+
46+
public void testNothing() {}
47+
}
48+
49+
public static class TearDown extends TestCase {
50+
@Override
51+
protected void tearDown() throws Exception {
52+
Host.executeCommand("cd ../rabbitmq-test; make disable-ha");
53+
HA_TESTS_RUNNING = false;
54+
}
55+
56+
public void testNothing() {}
57+
}
58+
}

test/src/com/rabbitmq/client/test/server/MessageRecovery.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ public void testMessageRecovery()
3434
waitForConfirms();
3535

3636
restart();
37-
assertDelivered(Q, 1);
37+
38+
// When testing in HA mode the message will be collected from a promoted
39+
// slave and wil have its redelivered flag set.
40+
assertDelivered(Q, 1, HATests.HA_TESTS_RUNNING);
3841
channel.queueDelete(Q);
3942
}
4043

test/src/com/rabbitmq/client/test/server/ServerTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
public class ServerTests extends TestCase {
2424
public static TestSuite suite() {
2525
TestSuite suite = new TestSuite("server-tests");
26+
add(suite);
27+
return suite;
28+
}
29+
30+
public static void add(TestSuite suite) {
2631
suite.addTestSuite(Permissions.class);
2732
suite.addTestSuite(DurableBindingLifecycle.class);
2833
suite.addTestSuite(EffectVisibilityCrossNodeTest.class);
@@ -32,6 +37,5 @@ public static TestSuite suite() {
3237
suite.addTestSuite(MessageRecovery.class);
3338
suite.addTestSuite(Firehose.class);
3439
suite.addTestSuite(PersistenceGuarantees.class);
35-
return suite;
3640
}
3741
}

0 commit comments

Comments
 (0)