Make sure to close Vert.x instances that are opened for testing (#280)

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
This commit is contained in:
Antoine Toulme
2019-12-23 09:33:16 -08:00
committed by Danno Ferrin
parent 0fdd09991d
commit 376ec111a3
4 changed files with 22 additions and 4 deletions

View File

@@ -82,6 +82,8 @@ import okhttp3.RequestBody;
import okhttp3.Response;
import org.apache.tuweni.units.bigints.UInt256;
import org.awaitility.Awaitility;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -94,6 +96,18 @@ public final class RunnerTest {
private static final int MAX_BACKGROUND_COMPACTIONS = 4;
private static final int BACKGROUND_THREAD_COUNT = 4;
private Vertx vertx;
@Before
public void initVertx() {
vertx = Vertx.vertx();
}
@After
public void stopVertx() {
vertx.close();
}
@Rule public final TemporaryFolder temp = new TemporaryFolder();
@Test
@@ -179,7 +193,7 @@ public final class RunnerTest {
final MetricsConfiguration aheadMetricsConfiguration = metricsConfiguration();
final RunnerBuilder runnerBuilder =
new RunnerBuilder()
.vertx(Vertx.vertx())
.vertx(vertx)
.discovery(true)
.p2pAdvertisedHost(listenHost)
.p2pListenPort(0)
@@ -313,7 +327,7 @@ public final class RunnerTest {
});
final Future<Void> future = Future.future();
final HttpClient httpClient = Vertx.vertx().createHttpClient();
final HttpClient httpClient = vertx.createHttpClient();
httpClient.websocket(
runnerBehind.getWebsocketPort().get(),
WebSocketConfiguration.DEFAULT_WEBSOCKET_HOST,

View File

@@ -44,13 +44,15 @@ public class EnclaveTest {
private static final String PAYLOAD = "a wonderful transaction";
private static final String MOCK_KEY = "iOCzoGo5kwtZU0J41Z9xnGXHN6ZNukIa9MspvHtu3Jk=";
private static Enclave enclave;
private Vertx vertx = Vertx.vertx();
private EnclaveFactory factory = new EnclaveFactory(vertx);
private Vertx vertx;
private EnclaveFactory factory;
private static OrionTestHarness testHarness;
@Before
public void setUp() throws Exception {
vertx = Vertx.vertx();
factory = new EnclaveFactory(vertx);
folder.create();
testHarness =

View File

@@ -103,6 +103,7 @@ public class RetestethService {
public void stop() {
jsonRpcHttpService.stop();
vertx.close();
}
private static Map<String, JsonRpcMethod> mapOf(final JsonRpcMethod... rpcMethods) {

View File

@@ -73,6 +73,7 @@ public class MetricsHttpServiceTest {
@AfterClass
public static void shutdownServer() {
service.stop().join();
vertx.close();
}
@Test