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

Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
pull/282/head
Antoine Toulme 5 years ago committed by Danno Ferrin
parent 0fdd09991d
commit 376ec111a3
  1. 18
      besu/src/test/java/org/hyperledger/besu/RunnerTest.java
  2. 6
      enclave/src/integration-test/java/org/hyperledger/besu/enclave/EnclaveTest.java
  3. 1
      ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/RetestethService.java
  4. 1
      metrics/core/src/test/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpServiceTest.java

@ -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,

@ -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 =

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

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

Loading…
Cancel
Save