geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [11/45] geode git commit: GEODE-1165: move FlakyTest category to class for all tests
Date Wed, 11 Jan 2017 00:00:11 GMT
GEODE-1165: move FlakyTest category to class for all tests


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/a6d6d08f
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/a6d6d08f
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/a6d6d08f

Branch: refs/heads/feature/GEODE-1930-2
Commit: a6d6d08fc6841d86e2e0cbd45ed43dfeb5affdcf
Parents: 921e1bc
Author: Kirk Lund <klund@apache.org>
Authored: Fri Jan 6 10:34:54 2017 -0800
Committer: Kirk Lund <klund@apache.org>
Committed: Fri Jan 6 10:36:00 2017 -0800

----------------------------------------------------------------------
 .../SharedConfigurationUsingDirDUnitTest.java   | 46 ++++++++++++--------
 1 file changed, 27 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/a6d6d08f/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
index 5d94869..a434f05 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/SharedConfigurationUsingDirDUnitTest.java
@@ -14,6 +14,22 @@
  */
 package org.apache.geode.management.internal.configuration;
 
+import static java.util.concurrent.TimeUnit.MINUTES;
+import static java.util.stream.Collectors.joining;
+import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.distributed.ConfigurationProperties.LOAD_CLUSTER_CONFIGURATION_FROM_DIR;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
+import static org.apache.geode.test.dunit.Host.getHost;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import com.jayway.awaitility.Awaitility;
+import com.jayway.awaitility.core.ConditionFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.distributed.Locator;
 import org.apache.geode.distributed.internal.InternalLocator;
@@ -34,17 +50,8 @@ import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import java.util.Arrays;
 import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
-import static org.apache.geode.test.dunit.Host.getHost;
-import static com.jayway.awaitility.Awaitility.waitAtMost;
-import static java.util.stream.Collectors.joining;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 
-@Category(DistributedTest.class)
+@Category({DistributedTest.class, FlakyTest.class}) // GEODE-1165
 public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase {
 
   @Override
@@ -82,12 +89,11 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase
{
       restartCache(vm, i, ports);
 
       vm.invoke("Checking for region presence", () -> {
-        waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion")
!= null);
+        await().until(() -> getRootRegion("newReplicatedRegion") != null);
       });
     }
   }
 
-  @Category(FlakyTest.class) // GEODE-1979
   @Test
   public void basicClusterConfigDirWithTwoLocators() throws Exception {
     final int[] ports = getRandomAvailableTCPPorts(2);
@@ -105,12 +111,11 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase
{
       restartCache(vm, i, ports);
 
       vm.invoke("Checking for region presence", () -> {
-        waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion")
!= null);
+        await().until(() -> getRootRegion("newReplicatedRegion") != null);
       });
     }
   }
 
-  @Category(FlakyTest.class) // GEODE-1165: random ports, BindException, time sensitive,
awaitility
   @Test
   public void updateClusterConfigDirWithTwoLocatorsNoRollingServerRestart() throws Exception
{
     final int[] ports = getRandomAvailableTCPPorts(2);
@@ -158,12 +163,11 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase
{
       restartCache(vm, i, ports);
 
       vm.invoke("Checking for region presence", () -> {
-        waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion")
!= null);
+        await().until(() -> getRootRegion("newReplicatedRegion") != null);
       });
     }
   }
 
-  @Category(FlakyTest.class) // GEODE-1989: need to increase await timeouts in these tests
   @Test
   public void updateClusterConfigDirWithTwoLocatorsAndRollingServerRestart() throws Exception
{
     final int[] ports = getRandomAvailableTCPPorts(2);
@@ -206,7 +210,7 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase
{
       restartCache(vm, i, ports);
 
       vm.invoke("Checking for region presence", () -> {
-        waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion")
!= null);
+        await().until(() -> getRootRegion("newReplicatedRegion") != null);
       });
     }
   }
@@ -249,7 +253,7 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase
{
       restartCache(vm, i, ports);
 
       vm.invoke("Checking for region presence", () -> {
-        waitAtMost(15, TimeUnit.SECONDS).until(() -> getRootRegion("newReplicatedRegion")
!= null);
+        await().until(() -> getRootRegion("newReplicatedRegion") != null);
       });
     }
   }
@@ -288,7 +292,7 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase
{
   private void waitForSharedConfiguration(final VM vm) {
     vm.invoke("Waiting for shared configuration", () -> {
       final InternalLocator locator = InternalLocator.getLocator();
-      waitAtMost(15, TimeUnit.SECONDS).until(() -> {
+      await().until(() -> {
         return locator.isSharedConfigurationRunning();
       });
     });
@@ -323,4 +327,8 @@ public class SharedConfigurationUsingDirDUnitTest extends JUnit4CacheTestCase
{
   private String getLocatorStr(final int[] locatorPorts) {
     return Arrays.stream(locatorPorts).mapToObj(p -> "localhost[" + p + "]").collect(joining(","));
   }
+
+  private ConditionFactory await() {
+    return Awaitility.await().atMost(2, MINUTES);
+  }
 }


Mime
View raw message