Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #250 'Throwables other than Exceptions are not propagated to the main thread ' #252

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose-rule-core/core.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
compile 'com.jayway.awaitility:awaitility:1.6.5'
compile 'org.awaitility:awaitility:3.1.2'
compile "com.github.zafarkhaja:java-semver:$javaSemverVersion"
compile "com.google.guava:guava:$guavaVersion"
compile "commons-io:commons-io:2.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package com.palantir.docker.compose.connection.waiting;

import com.jayway.awaitility.Awaitility;
import com.jayway.awaitility.core.ConditionTimeoutException;
import com.palantir.docker.compose.connection.Cluster;
import java.util.Optional;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
import org.joda.time.ReadableDuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.github.zafarkhaja.semver.Version;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.jayway.awaitility.Awaitility;
import com.palantir.docker.compose.configuration.DockerComposeFiles;
import com.palantir.docker.compose.configuration.ProjectName;
import com.palantir.docker.compose.connection.Container;
Expand All @@ -37,6 +36,7 @@
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.IOUtils;
import org.awaitility.Awaitility;
import org.joda.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

package com.palantir.docker.compose.connection;

import static com.jayway.awaitility.Awaitility.await;
import static com.palantir.docker.compose.execution.DockerComposeExecArgument.arguments;
import static com.palantir.docker.compose.execution.DockerComposeExecOption.noOptions;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeThat;

import com.github.zafarkhaja.semver.Version;
import com.jayway.awaitility.core.ConditionFactory;
import com.palantir.docker.compose.configuration.DockerComposeFiles;
import com.palantir.docker.compose.configuration.ProjectName;
import com.palantir.docker.compose.execution.DefaultDockerCompose;
Expand All @@ -21,6 +20,7 @@
import com.palantir.docker.compose.execution.DockerExecutable;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.awaitility.core.ConditionFactory;
import org.junit.Test;
import org.mockito.internal.matchers.GreaterOrEqual;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,32 @@ public class ClusterWaitShould {

wait.waitUntilReady(cluster);
}

@SuppressWarnings("unchecked")
@Test public void
should_propagate_throwable() throws InterruptedException {
class AThrowable extends Throwable {}

when(clusterHealthCheck.isClusterHealthy(cluster))
.thenThrow(AThrowable.class);

exception.expect(AThrowable.class);

ClusterWait wait = new ClusterWait(clusterHealthCheck, DURATION);
wait.waitUntilReady(cluster);
}

@SuppressWarnings("unchecked")
@Test public void
should_propagate_error() throws InterruptedException {
class AnError extends Error {}

when(clusterHealthCheck.isClusterHealthy(cluster))
.thenThrow(AnError.class);

exception.expect(AnError.class);

ClusterWait wait = new ClusterWait(clusterHealthCheck, DURATION);
wait.waitUntilReady(cluster);
}
}
2 changes: 1 addition & 1 deletion docker-compose-rule-junit4/junit4.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies {
compile project(':docker-compose-rule-core')

testCompile 'com.github.zafarkhaja:java-semver:0.9.0'
testCompile 'com.jayway.awaitility:awaitility:1.6.5'
testCompile 'org.awaitility:awaitility:3.1.2'
testCompile 'commons-io:commons-io:2.4'
testCompile "com.google.guava:guava:$guavaVersion"
testCompile "joda-time:joda-time:$jodaVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
package com.palantir.docker.compose;

import static com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly;
import static com.jayway.awaitility.Awaitility.await;
import static com.palantir.docker.compose.execution.DockerComposeExecArgument.arguments;
import static com.palantir.docker.compose.execution.DockerComposeExecOption.noOptions;
import static org.awaitility.Awaitility.await;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeThat;

Expand Down