Fix test timeout issues in quickstart tests (#417)

* 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.
Danno Ferrin 6 years ago committed by GitHub
parent e6662125ca
commit 24aac90efb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      quickstart/build.gradle
  2. 22
      quickstart/src/test/java/tech/pegasys/pantheon/tests/quickstart/DockerQuickstartTest.java

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

@ -27,12 +27,14 @@ import java.nio.file.Paths;
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;
@ -42,12 +44,14 @@ import org.junit.After;
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 =
@ -106,7 +110,7 @@ public class DockerQuickstartTest {
assertThat(services).isNotNull().isNotEmpty();
assertThat(endpoints).isNotNull().isNotEmpty();
HttpService httpService =
final HttpService httpService =
new HttpService(
DEFAULT_HTTP_RPC_HOST
+ ":"
@ -170,10 +174,11 @@ public class DockerQuickstartTest {
}
@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())
@ -213,16 +218,17 @@ public class DockerQuickstartTest {
}
@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
@ -258,7 +264,7 @@ public class DockerQuickstartTest {
Awaitility.await()
.ignoreExceptions()
.atMost(30, TimeUnit.SECONDS)
.atMost(45, TimeUnit.SECONDS)
.untilAsserted(() -> assertThat(wsConnection[0]).isNotNull());
} finally {
assertThat(wsConnection[0]).isNotNull();

Loading…
Cancel
Save