Fixes incomplete promise when a child verticle could not be deployed … (#3186)

* Fixes incomplete promise when a child verticle could not be deployed because its parent has been undeployed

Signed-off-by: zenios <dimitris.zenios@gmail.com>

* Added tests

Signed-off-by: zenios <dimitris.zenios@gmail.com>

* Fail the promise after undeploy is completed

Signed-off-by: zenios <dimitris.zenios@gmail.com>

* Simplify test using onSuccess / onFailure

Signed-off-by: zenios <dimitris.zenios@gmail.com>

* Use await / testComplete instead of CountDownLatch

Signed-off-by: zenios <dimitris.zenios@gmail.com>
This commit is contained in:
zenios
2019-11-14 00:25:01 +02:00
committed by Julien Viet
parent 97d3614496
commit 58f2c881ba
2 changed files with 17 additions and 1 deletions

View File

@@ -463,7 +463,7 @@ public class DeploymentManager {
deployment.child = true;
} else {
// Orphan
deployment.undeploy(null);
deployment.undeploy(event -> promise.fail("Verticle deployment failed.Could not be added as child of parent verticle"));
return;
}
}

View File

@@ -1234,6 +1234,22 @@ public class DeploymentTest extends VertxTestBase {
vertx = null;
}
@Test
public void testDeployChildOnParentUndeploy() {
class ParentVerticle extends AbstractVerticle {
@Override
public void stop(Promise<Void> stopPromise) {
vertx.deployVerticle(ChildVerticle.class.getName())
.<Void>mapEmpty()
.setHandler(stopPromise);
}
}
vertx.deployVerticle(new ParentVerticle(), onSuccess(id ->
vertx.undeploy(id, onFailure(u -> testComplete()))));
await();
}
@Test
public void testUndeployAllFailureInUndeploy() throws Exception {
int numVerticles = 10;