Skip to content

Commit

Permalink
Hardened junit long test RebalanceLongTest.java. Other test hardening.
Browse files Browse the repository at this point in the history
build.xml
- bumped all maxmemory settings to 2048m
- Placed a 90 minute timeout on the long test at ant level.

test/long/voldemort/client/rebalance/RebalanceLongTest.java
- null out some objects in the hopes of reducing the overall memory footprint of these tests. We are truly abusing junit with a long-running, multi-threaded test, that has 10 sub tests and 4 distinct parameter settings.

test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java
- start of tests is not clear in junit log output. Added logger.info to start of tests to make grepping through the log when tests have failed badly and/or are running in an infitie loop easier.
- Bumped each test timeout up to 10 minutes. Again, note abuse of junit: tests should not be defined at the abstract class level. This makes it hard to set appropriate limits (such as timeout) for each specific test. Long tests should have a different timeout than short tests...
  • Loading branch information
jayjwylie committed Oct 17, 2012
1 parent 34ab463 commit e1796c4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
8 changes: 4 additions & 4 deletions build.xml
Expand Up @@ -222,7 +222,7 @@
<target name="contrib-junit" depends="contrib-jar" description="Run contrib junit tests except EC2 and Krati tests.">
<replace-dir dir="${contribtestreport.dir}" />
<replace-dir dir="${contribtesthtml.dir}" />
<junit printsummary="yes" maxmemory="1024m" showoutput="true" failureProperty="test.failure">
<junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
<classpath refid="contrib-test-classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${contribtestreport.dir}">
Expand All @@ -249,7 +249,7 @@
</copy>
<replace-dir dir="${contribtestreport.dir}" />
<replace-dir dir="${contribtesthtml.dir}" />
<junit printsummary="yes" maxmemory="1024m" showoutput="true" failureProperty="test.failure">
<junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
<syspropertyset>
<propertyref prefix="ec2" />
</syspropertyset>
Expand Down Expand Up @@ -402,10 +402,10 @@
<target name="junit-long" depends="build, buildtest, junit" description="Run long junit tests that uses larger data sets than normal junit tests.">
<replace-dir dir="${longtestreport.dir}" />
<replace-dir dir="${longtesthtml.dir}" />
<junit printsummary="yes" showoutput="true" maxmemory="2048m">
<junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
<classpath refid="test-classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${longtestreport.dir}">
<batchtest todir="${longtestreport.dir}">
<fileset dir="${longtestsrc.dir}">
<include name="**/*Test.java" />
</fileset>
Expand Down
4 changes: 3 additions & 1 deletion test/long/voldemort/client/rebalance/RebalanceLongTest.java
Expand Up @@ -30,14 +30,15 @@
@RunWith(Parameterized.class)
public class RebalanceLongTest extends AbstractRebalanceTest {

Map<Integer, VoldemortServer> serverMap = new HashMap<Integer, VoldemortServer>();
Map<Integer, VoldemortServer> serverMap;
private final boolean useNio;
private final boolean useDonorBased;
protected static int NUM_MANY_KEYS = 10100;

public RebalanceLongTest(boolean useNio, boolean useDonorBased) {
this.useNio = useNio;
this.useDonorBased = useDonorBased;
this.serverMap = new HashMap<Integer, VoldemortServer>();
}

@Parameters
Expand Down Expand Up @@ -110,6 +111,7 @@ protected void stopServer(List<Integer> nodesToStop) throws IOException {
// ignore these at stop time
}
}
serverMap = null;
}

@Override
Expand Down
35 changes: 25 additions & 10 deletions test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java
Expand Up @@ -38,6 +38,7 @@
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -86,6 +87,8 @@

public abstract class AbstractRebalanceTest {

private static final Logger logger = Logger.getLogger(AbstractRebalanceTest.class.getName());

protected static int NUM_KEYS = 20;
protected static int NUM_RO_CHUNKS_PER_BUCKET = 10;
protected static String testStoreNameRW = "test";
Expand Down Expand Up @@ -213,7 +216,9 @@ public void setUp() throws IOException {
@After
public void tearDown() {
testEntries.clear();
testEntries = null;
socketStoreFactory.close();
socketStoreFactory = null;
}

protected abstract Cluster startServers(Cluster cluster,
Expand Down Expand Up @@ -262,8 +267,9 @@ protected int getNumKeys() {
return NUM_KEYS;
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testRORWRebalance() throws Exception {
logger.info("Starting testRORWRebalance");
Cluster currentCluster = ServerTestUtils.getLocalCluster(2, new int[][] {
{ 0, 1, 2, 3, 4, 5, 6, 7, 8 }, {} });

Expand Down Expand Up @@ -313,8 +319,9 @@ public void testRORWRebalance() throws Exception {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testRORWRebalanceWithReplication() throws Exception {
logger.info("Starting testRORWRebalanceWithReplication");
Cluster currentCluster = ServerTestUtils.getLocalCluster(2, new int[][] {
{ 0, 1, 2, 3, 4, 5, 6 }, { 7, 8 } });

Expand Down Expand Up @@ -363,8 +370,9 @@ public void testRORWRebalanceWithReplication() throws Exception {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testRORebalanceWithReplication() throws Exception {
logger.info("Starting testRORebalanceWithReplication");
Cluster currentCluster = ServerTestUtils.getLocalCluster(2, new int[][] {
{ 0, 1, 2, 3, 4, 5, 6 }, { 7, 8 } });

Expand Down Expand Up @@ -415,8 +423,9 @@ public void testRORebalanceWithReplication() throws Exception {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testRWRebalanceWithReplication() throws Exception {
logger.info("Starting testRWRebalanceWithReplication");
Cluster currentCluster = ServerTestUtils.getLocalCluster(2, new int[][] {
{ 0, 1, 2, 3, 4, 5, 6 }, { 7, 8 } });

Expand Down Expand Up @@ -457,8 +466,9 @@ public void testRWRebalanceWithReplication() throws Exception {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testRebalanceCleanPrimary() throws Exception {
logger.info("Starting testRebalanceCleanPrimary");
Cluster currentCluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0 }, { 1, 3 },
{ 2 } });

Expand Down Expand Up @@ -558,8 +568,9 @@ public void testRebalanceCleanPrimary() throws Exception {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testRebalanceCleanSecondary() throws Exception {
logger.info("Starting testRebalanceCleanSecondary");
Cluster currentCluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0, 3 }, { 1 },
{ 2 } });

Expand Down Expand Up @@ -660,8 +671,9 @@ public void testRebalanceCleanSecondary() throws Exception {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testRWRebalanceFourNodes() throws Exception {
logger.info("Starting testRWRebalanceFourNodes");
Cluster currentCluster = ServerTestUtils.getLocalCluster(4, new int[][] {
{ 0, 1, 4, 7, 9 }, { 2, 3, 5, 6, 8 }, {}, {} });

Expand Down Expand Up @@ -720,8 +732,9 @@ public void testRWRebalanceFourNodes() throws Exception {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testRWRebalanceSerial() throws Exception {
logger.info("Starting testRWRebalanceSerial");
Cluster currentCluster = ServerTestUtils.getLocalCluster(4, new int[][] {
{ 0, 1, 4, 7, 9 }, { 2, 3, 5, 6, 8 }, {}, {} });

Expand Down Expand Up @@ -782,8 +795,9 @@ public void testRWRebalanceSerial() throws Exception {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testProxyGetDuringRebalancing() throws Exception {
logger.info("Starting testProxyGetDuringRebalancing");
final Cluster currentCluster = ServerTestUtils.getLocalCluster(2, new int[][] {
{ 0, 1, 2, 3, 4, 5, 6 }, { 7, 8 } });

Expand Down Expand Up @@ -918,8 +932,9 @@ public void run() {
}
}

@Test(timeout = 60000)
@Test(timeout = 600000)
public void testServerSideRouting() throws Exception {
logger.info("Starting testServerSideRouting");
final Cluster currentCluster = ServerTestUtils.getLocalCluster(2, new int[][] {
{ 0, 1, 2, 3, 4, 5, 6 }, { 7, 8 } });

Expand Down

0 comments on commit e1796c4

Please sign in to comment.