Skip to content
Permalink
Browse files

Fix LocalDeployer to fail faster in status()

Also, have a better default name for deployed apps in tests
  • Loading branch information
ericbottard committed Aug 16, 2016
1 parent 35636e4 commit a6900132b696cde6c4b61c67bd6a3842753b3662
@@ -233,6 +233,7 @@ public DeploymentState getState() {
}
try {
HttpURLConnection urlConnection = (HttpURLConnection) baseUrl.openConnection();
urlConnection.setConnectTimeout(100);
urlConnection.connect();
urlConnection.disconnect();
return DeploymentState.deployed;
@@ -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;
@@ -83,6 +85,9 @@

protected abstract AppDeployer appDeployer();

@Rule
public TestName name = new TestName();

@Test
public void testUnknownDeployment() {
String unknownId = randomName();
@@ -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);
@@ -371,9 +376,8 @@ public void testMultipleInstancesDeploymentAndPartialState() {
}



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

/**

0 comments on commit a690013

Please sign in to comment.
You can’t perform that action at this time.