Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Fix test timeout issues in quickstart tests (#417)
Browse files Browse the repository at this point in the history
* fix rpcNodeShouldReturnCorrectVersion to be JVM/OS tolerant
* make sure "servicesShouldBeUp" is the first test run
  * First have tests executed by sort order rather than quasi-random order
  * add an underscore so that "_servicesShouldBeUp" runs first.
  * increase first timeout to 90 sec as a general hedge.
  • Loading branch information
shemnon authored Dec 13, 2018
1 parent e666212 commit 24aac90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions quickstart/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies {

testImplementation project(':pantheon')

testImplementation 'com.google.guava:guava'
testImplementation 'com.squareup.okhttp3:okhttp'
testImplementation 'io.vertx:vertx-core'
testImplementation 'junit:junit'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
import java.util.Arrays;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.google.common.base.Splitter;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.http.RequestOptions;
Expand All @@ -42,12 +44,14 @@
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.http.HttpService;
import org.web3j.utils.Async;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class DockerQuickstartTest {

private static final String PROJECT_ROOT =
Expand Down Expand Up @@ -106,7 +110,7 @@ public void listQuickstartServices() throws IOException, InterruptedException {
assertThat(services).isNotNull().isNotEmpty();
assertThat(endpoints).isNotNull().isNotEmpty();

HttpService httpService =
final HttpService httpService =
new HttpService(
DEFAULT_HTTP_RPC_HOST
+ ":"
Expand Down Expand Up @@ -170,10 +174,11 @@ public static void removePantheonPrivateNetwork() throws IOException, Interrupte
}

@Test
public void servicesShouldBeUp() {
// Method starts with an underscore so it lexicographically sorts first.
public void _servicesShouldBeUp() {
Awaitility.await()
.ignoreExceptions()
.atMost(60, TimeUnit.SECONDS)
.atMost(90, TimeUnit.SECONDS)
.untilAsserted(
() ->
Arrays.stream(ServicesIdentifier.values())
Expand Down Expand Up @@ -213,16 +218,17 @@ public void rpcNodeShouldFindPeers() {
}

@Test
@Ignore
public void rpcNodeShouldReturnCorrectVersion() {
final String expectedVersion = PantheonInfo.version();
final Iterator<String> versionParts = Splitter.on("/").split(PantheonInfo.version()).iterator();
final String versionPrefix = versionParts.next() + "/" + versionParts.next() + "/";

Awaitility.await()
.ignoreExceptions()
.atMost(60, TimeUnit.SECONDS)
.untilAsserted(
() ->
assertThat(web3HttpClient.web3ClientVersion().send().getWeb3ClientVersion())
.isEqualTo(expectedVersion));
.startsWith(versionPrefix));
}

@Test
Expand Down Expand Up @@ -258,7 +264,7 @@ public void webSocketRpcServiceMustConnect() {

Awaitility.await()
.ignoreExceptions()
.atMost(30, TimeUnit.SECONDS)
.atMost(45, TimeUnit.SECONDS)
.untilAsserted(() -> assertThat(wsConnection[0]).isNotNull());
} finally {
assertThat(wsConnection[0]).isNotNull();
Expand Down

0 comments on commit 24aac90

Please sign in to comment.