brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [6/7] git commit: Fix RedisIntegrationTest
Date Wed, 29 Oct 2014 16:19:47 GMT
Fix RedisIntegrationTest

- increase timeout, because on jenkins sometimes it takes crazy long
  (e.g. 26 seconds) for `info server` to return.


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

Branch: refs/heads/master
Commit: a910375a08b76abc9100f461c02f476540c13b8a
Parents: 0f77637
Author: Aled Sage <aled.sage@gmail.com>
Authored: Wed Oct 29 12:36:15 2014 +0000
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Wed Oct 29 16:02:00 2014 +0000

----------------------------------------------------------------------
 .../entity/nosql/redis/RedisIntegrationTest.java     | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a910375a/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.java
b/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.java
index b0de43b..9ecf445 100644
--- a/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.java
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.java
@@ -24,19 +24,18 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.entity.trait.Startable;
 import brooklyn.location.Location;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
 import brooklyn.location.basic.PortRanges;
 import brooklyn.test.EntityTestUtils;
 import brooklyn.test.entity.TestApplication;
+import brooklyn.util.time.Duration;
 
 import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 
 /**
  * Test the operation of the {@link RedisStore} class.
@@ -49,8 +48,8 @@ public class RedisIntegrationTest {
 
     @BeforeMethod(alwaysRun=true)
     public void setup() {
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
-        loc = new LocalhostMachineProvisioningLocation();
+        app = TestApplication.Factory.newManagedInstanceForTests();
+        loc = app.newLocalhostProvisioningLocation();
     }
 
     @AfterMethod(alwaysRun=true)
@@ -100,7 +99,11 @@ public class RedisIntegrationTest {
         JedisSupport support = new JedisSupport(redis);
         support.redisTest();
 
-        EntityTestUtils.assertPredicateEventuallyTrue(redis, new Predicate<RedisStore>()
{
+        // Increase timeout because test was failing on jenkins sometimes. The log shows
only one 
+        // call to `info server` (for obtaining uptime) which took 26 seconds; then 4 seconds
later 
+        // this assert failed (with it checking every 500ms). The response did correctly
contain
+        // `uptime_in_seconds:27`.
+        EntityTestUtils.assertPredicateEventuallyTrue(ImmutableMap.of("timeout", Duration.FIVE_MINUTES),
redis, new Predicate<RedisStore>() {
             @Override public boolean apply(@Nullable RedisStore input) {
                 return input != null &&
                         input.getAttribute(RedisStore.UPTIME) > 0 &&


Mime
View raw message