Skip to content

Commit

Permalink
[grid] Fixing DistributedCdpTest
Browse files Browse the repository at this point in the history
The router was missing the sessionqueuer
flag.
  • Loading branch information
diemol committed Nov 10, 2020
1 parent 9320d5c commit 5487348
Showing 1 changed file with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public void ensureBasicFunctionality() throws MalformedURLException, Interrupted

int eventPublishPort = PortProber.findFreePort();
int eventSubscribePort = PortProber.findFreePort();
String[] eventBusFlags = new String[]{"--publish-events", "tcp://*:" + eventPublishPort, "--subscribe-events", "tcp://*:" + eventSubscribePort};
String[] eventBusFlags = new String[]{
"--publish-events", "tcp://*:" + eventPublishPort,
"--subscribe-events", "tcp://*:" + eventSubscribePort};

int eventBusPort = PortProber.findFreePort();
new EventBusCommand().configure(
Expand Down Expand Up @@ -106,20 +108,28 @@ public void ensureBasicFunctionality() throws MalformedURLException, Interrupted
new RouterServer().configure(
System.out,
System.err,
"--port", "" + routerPort, "-s", "http://localhost:" + sessionsPort, "-d", "http://localhost:" + distributorPort).run();
"--port", "" + routerPort,
"-s", "http://localhost:" + sessionsPort,
"-d", "http://localhost:" + distributorPort,
"--sessionqueuer", "http://localhost:" + queuerPort).run();
waitUntilUp(routerPort);

int nodePort = PortProber.findFreePort();
new NodeServer().configure(
System.out,
System.err,
mergeArgs(eventBusFlags, "--port", "" + nodePort, "-I", getBrowserShortName(), "--public-url", "http://localhost:" + routerPort)).run();
mergeArgs(
eventBusFlags,
"--port", "" + nodePort,
"-I", getBrowserShortName(),
"--public-url", "http://localhost:" + routerPort)).run();
waitUntilUp(nodePort);

HttpClient client = HttpClient.Factory.createDefault().createClient(new URL("http://localhost:" + routerPort));
new FluentWait<>(client).withTimeout(ofSeconds(10)).until(c -> {
HttpResponse res = c.execute(new HttpRequest(GET, "/status")
.addHeader("Content-Type", "application/json; charset=utf-8"));
HttpResponse res = c.execute(
new HttpRequest(GET, "/status")
.addHeader("Content-Type", "application/json; charset=utf-8"));
if (!res.isSuccessful()) {
return false;
}
Expand All @@ -135,7 +145,8 @@ public void ensureBasicFunctionality() throws MalformedURLException, Interrupted
req -> new HttpResponse().setContent(Contents.utf8String("I like cheese")))
.start();

WebDriver driver = new RemoteWebDriver(new URL("http://localhost:" + routerPort), browser.getCapabilities());
WebDriver driver = new RemoteWebDriver(
new URL("http://localhost:" + routerPort), browser.getCapabilities());
driver = new Augmenter().augment(driver);

CountDownLatch latch = new CountDownLatch(1);
Expand All @@ -145,7 +156,13 @@ public void ensureBasicFunctionality() throws MalformedURLException, Interrupted
devTools.addListener(Network.loadingFinished(), res -> latch.countDown());
devTools.send(Network.enable(Optional.empty(), Optional.empty(), Optional.empty()));

devTools.send(Page.navigate(server.getUrl().toString(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
devTools.send(
Page.navigate(
server.getUrl().toString(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty()));
assertThat(latch.await(10, SECONDS)).isTrue();
}
}
Expand Down

0 comments on commit 5487348

Please sign in to comment.