Search in sources :

Example 6 with TestSlot

use of org.openqa.grid.internal.TestSlot in project zalenium by zalando.

the class DockerSeleniumRemoteProxy method terminateIdleTest.

/*
        Method to terminate an idle session via the registry, the code works because each one has only one slot
        We use BROWSER_TIMEOUT as a reason, but this could be changed in the future to show a more clear reason
     */
@VisibleForTesting
protected synchronized void terminateIdleTest() {
    for (TestSlot testSlot : getTestSlots()) {
        if (testSlot.getSession() != null) {
            long executionTime = (System.currentTimeMillis() - testSlot.getLastSessionStart()) / 1000;
            ga.testEvent(DockerSeleniumRemoteProxy.class.getName(), testSlot.getSession().getRequestedCapabilities().toString(), executionTime);
            getRegistry().forceRelease(testSlot, SessionTerminationReason.ORPHAN);
        }
    }
}
Also used : TestSlot(org.openqa.grid.internal.TestSlot) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

TestSlot (org.openqa.grid.internal.TestSlot)6 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 HashMap (java.util.HashMap)2 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)2 TestSession (org.openqa.grid.internal.TestSession)1 Platform (org.openqa.selenium.Platform)1