Skip to content

Commit

Permalink
Fix tests for testStartVoldemortCluster to not consume so much memory
Browse files Browse the repository at this point in the history
test/common/voldemort/ServerTestUtils.java
- remove stress test from normal testing
- test the method startVoldemortCluster once and confirm it returns a non-null Cluster object

test/common/voldemort/ServerTestUtils.java
- clarified a comment
  • Loading branch information
jayjwylie committed Jan 10, 2013
1 parent db493a1 commit 4ae1336
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
10 changes: 6 additions & 4 deletions test/common/voldemort/ServerTestUtils.java
Expand Up @@ -760,11 +760,13 @@ protected static Cluster internalStartVoldemortCluster(int numServers,
}

/**
* This method wraps up work that is done in many different tests to set up
* some number of Voldemort servers in a cluster. This method masks an
* intermittent TOCTOU problem with the ports identified by
* This method wraps up all of the work that is done in many different tests
* to set up some number of Voldemort servers in a cluster. This method
* masks an intermittent TOCTOU problem with the ports identified by
* {@link #findFreePorts(int)} not actually being free when a server needs
* to bind to them.
* to bind to them. If this method returns, it will return a non-null
* cluster. This method is not guaranteed to return, but will likely
* eventually do so...
*
* @param numServers
* @param voldemortServers
Expand Down
36 changes: 22 additions & 14 deletions test/unit/voldemort/utils/ServerTestUtilsTest.java
Expand Up @@ -41,30 +41,38 @@ public class ServerTestUtilsTest {
100000,
32 * 1024);

@Test
public void testStartVoldemortCluster() throws IOException {
int numServers = 8;
VoldemortServer[] servers = new VoldemortServer[numServers];
int partitionMap[][] = { { 0 }, { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 } };
ServerTestUtils.startVoldemortCluster(numServers,
servers,
partitionMap,
socketStoreFactory,
true,
null,
storesXmlfile,
new Properties());
Cluster cluster = ServerTestUtils.startVoldemortCluster(numServers,
servers,
partitionMap,
socketStoreFactory,
true,
null,
storesXmlfile,
new Properties());
assertTrue(cluster != null);
}

@Test
public void startMultipleVoldemortClusters() throws IOException {
// **********************************************************************
// * START : "commented out" tests
// These tests helped to find the root case of BindException problem when
// clusters were started. These tests were used in debugging and stress
// testing and should not be part of our general junit tests. The @Test
// parameter is therefore commented out. The debugging methods themselves
// are not commented out so that they can be kept up to date with other code
// changes.

// @Test
public void stressTestStartVoldemortCluster() throws IOException {
for(int i = 0; i < 10; i++) {
testStartVoldemortCluster();
}
}

// **********************************************************************
// * START : TESTS THAT HELPED FIND ROOT CAUSE OF BindException PROBLEM *

// @Test
public void startMultipleVoldemortServers() throws IOException {
Cluster cluster = ServerTestUtils.getLocalCluster(8, new int[][] { { 0 }, { 1 }, { 2 },
Expand Down Expand Up @@ -180,6 +188,6 @@ public void testFindFreePorts100() throws Exception {
}
}

// ** END : TESTS THAT HELPED FIND ROOT CAUSE OF BindException PROBLEM **
// * END : "commented out" tests
// **********************************************************************
}

0 comments on commit 4ae1336

Please sign in to comment.