fixing CI failure This test periodically failed to find 2 live servers due to an assumption in the test that Pool.borrowConnection() would never find the initial connection created by the pool in prefillConnections(). That caused it to only be connected to one of the three servers instead of the expected two. The fix is to explicitely ask for a connection to the second server.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/dfb3306c Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/dfb3306c Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/dfb3306c Branch: refs/heads/master Commit: dfb3306c527673548858e77fb3b1049e3b1df186 Parents: 61a16b1 Author: Bruce Schuchardt <bschucha...@pivotal.io> Authored: Wed Jan 6 15:10:51 2016 -0800 Committer: Bruce Schuchardt <bschucha...@pivotal.io> Committed: Wed Jan 6 15:10:51 2016 -0800 ---------------------------------------------------------------------- .../internal/cache/tier/sockets/CacheServerTestUtil.java | 2 ++ .../tier/sockets/HAStartupAndFailoverDUnitTest.java | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfb3306c/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java index 18b7d39..123a275 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java @@ -516,6 +516,7 @@ public class CacheServerTestUtil extends DistributedTestCase */ public static void disableShufflingOfEndpoints() { + // TODO DISABLE_RANDOM doesn't seem to be used anywhere System.setProperty("gemfire.PoolImpl.DISABLE_RANDOM", "true"); System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "true"); } @@ -525,6 +526,7 @@ public class CacheServerTestUtil extends DistributedTestCase */ public static void enableShufflingOfEndpoints() { + // TODO DISABLE_RANDOM doesn't seem to be used anywhere System.setProperty("gemfire.PoolImpl.DISABLE_RANDOM", "false"); System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "false"); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfb3306c/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java index 1d9f08d..9a00680 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java @@ -281,7 +281,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase verifyDeadAndLiveServers(2,1); server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive"); } - + /** * Tests failover initialization by cache operation Threads on secondary */ @@ -652,10 +652,13 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase cache.createRegion(REGION_NAME, attrs); pool = p; - conn = pool.acquireConnection(); - assertNotNull(conn); - + // since the default minConnections is 1 we currently have a connection to + // server1 (vm_0). Now we create a connection to server2 (vm_1) + conn = pool.acquireConnection(new ServerLocation(Host.getHost(0).getHostName(), PORT2)); + // assert that the conn is to server2 since the tests assume that this is so + assertNotNull(conn); + assertTrue(conn.getEndpoint().getLocation().getPort() == PORT2); } public static void createClientCacheWithIncorrectPrimary(String testName, String host) throws Exception