You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by dr...@apache.org on 2017/05/23 13:29:51 UTC
[1/2] brooklyn-server git commit: Fix non-deterministic
DefaultCOnnectivityResolverTest
Repository: brooklyn-server
Updated Branches:
refs/heads/master 2bb8572f4 -> 377454ed8
Fix non-deterministic DefaultCOnnectivityResolverTest
Was failing on apache Jenkins sometimes, due to a 1ms timeout!
Increased this to 100ms, which still feels low (but unfortunately
The test will take a minimum of `Math.min(timeout, gracePeriod)`.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2952ea1d
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2952ea1d
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2952ea1d
Branch: refs/heads/master
Commit: 2952ea1d8ace5ed5eb4058f3ef1280c8dd8160d6
Parents: 2bb8572
Author: Aled Sage <al...@gmail.com>
Authored: Tue May 23 11:09:03 2017 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue May 23 11:09:03 2017 +0100
----------------------------------------------------------------------
.../jclouds/DefaultConnectivityResolverTest.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2952ea1d/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java
index 6088c54..6e7d8b0 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolverTest.java
@@ -151,7 +151,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
JcloudsLocationConfig.WAIT_FOR_SSHABLE, "1ms",
JcloudsLocationConfig.POLL_FOR_FIRST_REACHABLE_ADDRESS, "1ms",
JcloudsLocation.CUSTOM_CREDENTIALS, credential));
- ConnectivityResolverOptions options = newResolveOptionsForIps(reachableIps).build();
+ ConnectivityResolverOptions options = newResolveOptionsForIps(reachableIps, Duration.millis(100)).build();
// Chooses authorisedHostAndPort when credentials are tested.
DefaultConnectivityResolver customizer = new DefaultConnectivityResolver(ImmutableMap.of(
@@ -193,7 +193,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of(
JcloudsLocationConfig.CONNECTIVITY_RESOLVER, customizer));
- ConnectivityResolverOptions options = newResolveOptionsForIps(reachableIps).build();
+ ConnectivityResolverOptions options = newResolveOptionsForIps(reachableIps, Duration.millis(100)).build();
ConfigBag configBag = ConfigBag.newInstance();
ManagementAddressResolveResult result = customizer.resolve(jcloudsLocation, newNodeMetadata(), configBag, options);
@@ -222,7 +222,7 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of(
JcloudsLocationConfig.CONNECTIVITY_RESOLVER, customizer));
- ConnectivityResolverOptions options = newResolveOptionsForIps(reachableIps).build();
+ ConnectivityResolverOptions options = newResolveOptionsForIps(reachableIps, Duration.ONE_MILLISECOND).build();
ConfigBag configBag = ConfigBag.newInstance();
customizer.resolve(jcloudsLocation, newNodeMetadata(), configBag, options);
}
@@ -232,9 +232,14 @@ public class DefaultConnectivityResolverTest extends AbstractJcloudsStubbedUnitT
.initialCredentials(credential);
}
- private ConnectivityResolverOptions.Builder newResolveOptionsForIps(Set<HostAndPort> reachableIps) {
+ private ConnectivityResolverOptions.Builder newResolveOptionsForIps(Set<HostAndPort> reachableIps, Duration timeout) {
+ // It's important to not use a tiny timeout (e.g. 1ms) if you expect it to succeed,
+ // because that can fail on apache jenkins. We execute the check in a background
+ // thread, and then wait for this timeout for it to succeed. On a slow machine, we
+ // might not have finished executing the predicate, so might abort.
+ // (see `ReachableSocketFinder.tryReachable()`, and its use of `timeout`).
return newResolveOptions().
- pollForReachableAddresses(Predicates.in(reachableIps), Duration.millis(1), true);
+ pollForReachableAddresses(Predicates.in(reachableIps), timeout, true);
}
private NodeMetadata newNodeMetadata() {
[2/2] brooklyn-server git commit: This closes #694
Posted by dr...@apache.org.
This closes #694
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/377454ed
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/377454ed
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/377454ed
Branch: refs/heads/master
Commit: 377454ed811bcf8fb2e279b91611dd8fc9566155
Parents: 2bb8572 2952ea1
Author: Duncan Godwin <dr...@googlemail.com>
Authored: Tue May 23 14:29:44 2017 +0100
Committer: Duncan Godwin <dr...@googlemail.com>
Committed: Tue May 23 14:29:44 2017 +0100
----------------------------------------------------------------------
.../jclouds/DefaultConnectivityResolverTest.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------