Skip to content

Commit

Permalink
Minor tweak to test setup. No logical changes
Browse files Browse the repository at this point in the history
Looking up host names can be slow on OS X from Java. Cache
the lookup of the host and port to try and speed things up
for this test.

Perhaps this is why the test is timing out on Travis?
  • Loading branch information
shs96c committed Feb 23, 2017
1 parent d2b1c51 commit 85638a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion java/client/test/org/openqa/selenium/ReferrerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.google.common.base.Charsets;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.net.HostAndPort;
Expand Down Expand Up @@ -454,6 +455,7 @@ protected void after() {
*/
private abstract static class ServerResource extends ExternalResource {
protected final Server server;
private HostAndPort hostAndPort;

ServerResource() {
server = new Server();
Expand All @@ -470,7 +472,7 @@ void addHandler(Handler handler) {
}

HostAndPort getHostAndPort() {
return HostAndPort.fromParts(server.getURI().getHost(), server.getURI().getPort());
return Preconditions.checkNotNull(hostAndPort);
}

String getBaseUrl() {
Expand All @@ -480,6 +482,7 @@ String getBaseUrl() {
void start() {
try {
server.start();
hostAndPort = HostAndPort.fromParts(server.getURI().getHost(), server.getURI().getPort());
new UrlChecker().waitUntilAvailable(10, TimeUnit.SECONDS, new URL(getBaseUrl()));
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down

0 comments on commit 85638a4

Please sign in to comment.