Skip to content

Commit

Permalink
fixing last two grid e2e test failures
Browse files Browse the repository at this point in the history
unignoring test / fixing it.
  • Loading branch information
lukeis committed Mar 16, 2016
1 parent 4bbd7ee commit 128319d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void setup() throws Exception {
gridHubConfiguration.port = PortProber.findFreePort();
gridHubConfiguration.host = "localhost";

gridHubConfiguration.browserTimeout = 10000;
gridHubConfiguration.browserTimeout = 5;
gridHubConfiguration.servlets = Arrays.asList("org.openqa.grid.e2e.node.SlowServlet");
hub = GridTestHelper.getHub(gridHubConfiguration);

Expand Down
17 changes: 8 additions & 9 deletions java/server/test/org/openqa/grid/e2e/node/NodeRecoveryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class NodeRecoveryTest {
private static Hub hub;
private static SelfRegisteringRemote node;

private static int originalTimeout = 3000;
private static int newtimeout = 20000;
private static int originalTimeout = 3;
private static int newtimeout = 20;

@BeforeClass
public static void setup() throws Exception {
Expand All @@ -64,20 +64,19 @@ public static void setup() throws Exception {
// register a selenium 1 with a timeout of 3 sec

node.addBrowser(GridTestHelper.getDefaultBrowserCapability(), 1);
node.setTimeout(originalTimeout, 1000);
node.setTimeout(originalTimeout, 100);
node.setRemoteServer(new SeleniumServer(node.getConfiguration()));
node.startRemoteServer();
node.sendRegistrationRequest();
RegistryTestHelper.waitForNode(hub.getRegistry(), 1);
}

@Ignore
@Test
public void nodeServerCanStopAndRestart() throws Exception {

assertEquals(hub.getRegistry().getAllProxies().size(), 1);
for (RemoteProxy p : hub.getRegistry().getAllProxies()) {
assertEquals(p.getTimeOut(), originalTimeout);
assertEquals(p.getTimeOut(), originalTimeout * 1000);
}

URL hubURL = new URL("http://" + hub.getConfiguration().host + ":" + hub.getConfiguration().port);
Expand All @@ -90,15 +89,15 @@ public void nodeServerCanStopAndRestart() throws Exception {


// change its config.
node.setTimeout(newtimeout, 1000);
node.setTimeout(newtimeout, 100);

// restart it
node.setRemoteServer(new SeleniumServer(node.getConfiguration()));
node.startRemoteServer();
node.sendRegistrationRequest();

// wait for 5 sec : the timeout of the original node should be reached, and the session freed
Thread.sleep(5000);
// the timeout of the original node should be reached, and the session freed
Thread.sleep(originalTimeout * 1000 + 100);

assertEquals(hub.getRegistry().getActiveSessions().size(), 0);

Expand All @@ -107,7 +106,7 @@ public void nodeServerCanStopAndRestart() throws Exception {

for (RemoteProxy p : hub.getRegistry().getAllProxies()) {
System.out.println(p);
assertEquals(p.getTimeOut(), newtimeout);
assertEquals(p.getTimeOut(), newtimeout * 1000);
}

}
Expand Down
4 changes: 2 additions & 2 deletions java/server/test/org/openqa/grid/e2e/node/SmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public void firefoxOnWebDriver() throws MalformedURLException {
try {
DesiredCapabilities caps = GridTestHelper.getDefaultBrowserCapability();
driver = new RemoteWebDriver(new URL(hub.getUrl() + "/wd/hub"), caps);
driver.get(hub.getUrl() + "/grid/old/console");
assertEquals(driver.getTitle(), "Grid overview");
driver.get(hub.getUrl() + "/grid/console");
assertEquals(driver.getTitle(), "Grid Console");
} finally {
if (driver != null) {
driver.quit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@ public void doesntExist() {
Class<? extends Servlet> servlet = ExtraServletUtil.createServlet(s);
assertNull(servlet);
}

@Test(expected = ClassCastException.class)
public void doesntExtendServlet() {
String s = this.getClass().getCanonicalName();
Class<? extends Servlet> servlet = ExtraServletUtil.createServlet(s);
}
}
27 changes: 27 additions & 0 deletions java/server/test/org/openqa/grid/e2e/utils/TestHttpServlet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package org.openqa.grid.e2e.utils;

import javax.servlet.http.HttpServlet;

/**
* sample servlet for ExtraServletUtilTest
*/
public class TestHttpServlet extends HttpServlet {

}

0 comments on commit 128319d

Please sign in to comment.