Permalink
Browse files

Fix tests for testStartVoldemortCluster to not consume so much memory

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...
1 parent db493a1 commit 4ae133681f2bffd532cd80a48ee4b25c42e1177a @jayjwylie jayjwylie committed Jan 10, 2013
Showing with 28 additions and 18 deletions.
  1. +6 −4 test/common/voldemort/ServerTestUtils.java
  2. +22 −14 test/unit/voldemort/utils/ServerTestUtilsTest.java
@@ -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
@@ -41,30 +41,38 @@
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 },
@@ -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.