Skip to content

Commit

Permalink
Fix LocalDeployer to fail faster in status()
Browse files Browse the repository at this point in the history
Also, have a better default name for deployed apps in tests
  • Loading branch information
ericbottard committed Aug 16, 2016
1 parent 35636e4 commit a690013
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public DeploymentState getState() {
}
try {
HttpURLConnection urlConnection = (HttpURLConnection) baseUrl.openConnection();
urlConnection.setConnectTimeout(100);
urlConnection.connect();
urlConnection.disconnect();
return DeploymentState.deployed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -83,6 +85,9 @@ public abstract class AbstractAppDeployerIntegrationTests {

protected abstract AppDeployer appDeployer();

@Rule
public TestName name = new TestName();

@Test
public void testUnknownDeployment() {
String unknownId = randomName();
Expand Down Expand Up @@ -357,9 +362,9 @@ public void testMultipleInstancesDeploymentAndPartialState() {
Map<String, AppInstanceStatus> instances = appDeployer().status(deploymentId).getInstances();
// Note we can't rely on instances order, neither on their id indicating their ordinal number
assertThat(instances.values(), containsInAnyOrder(
hasProperty("state", is(deployed)),
hasProperty("state", is(deployed)),
hasProperty("state", is(failed))
hasProperty("state", is(deployed)),
hasProperty("state", is(deployed)),
hasProperty("state", is(failed))
));

log.info("Undeploying {}...", deploymentId);
Expand All @@ -371,9 +376,8 @@ public void testMultipleInstancesDeploymentAndPartialState() {
}



protected String randomName() {
return UUID.randomUUID().toString();
return name.getMethodName() + "-" + UUID.randomUUID().toString();
}

/**
Expand Down

0 comments on commit a690013

Please sign in to comment.