diff --git a/test/common/voldemort/ServerTestUtils.java b/test/common/voldemort/ServerTestUtils.java index 1da8a3994c..49ecfb0f94 100644 --- a/test/common/voldemort/ServerTestUtils.java +++ b/test/common/voldemort/ServerTestUtils.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 diff --git a/test/unit/voldemort/utils/ServerTestUtilsTest.java b/test/unit/voldemort/utils/ServerTestUtilsTest.java index 5608a6e605..ee2bf7cb99 100644 --- a/test/unit/voldemort/utils/ServerTestUtilsTest.java +++ b/test/unit/voldemort/utils/ServerTestUtilsTest.java @@ -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 }, @@ -180,6 +188,6 @@ public void testFindFreePorts100() throws Exception { } } - // ** END : TESTS THAT HELPED FIND ROOT CAUSE OF BindException PROBLEM ** + // * END : "commented out" tests // ********************************************************************** }