Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
[BUA-925] Forcing container creation when it has been waiting too. long.
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Mar 21, 2017
1 parent 423dad9 commit 0b12a99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
<selenium-server.patch-level.version>0</selenium-server.patch-level.version>
<docker-client.version>8.1.2</docker-client.version>
<junit.version>4.12</junit.version>
<mockito.version>2.7.17</mockito.version>
<mockito.version>2.7.18</mockito.version>
<awaitility.version>2.0.0</awaitility.version>
<testng.version>6.11</testng.version>
<slf4j.version>1.7.24</slf4j.version>
<slf4j.version>1.7.25</slf4j.version>
<surefire.version>2.19.1</surefire.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ public TestSession getNewSession(Map<String, Object> requestedCapability) {
} else {
int attempts = (int) requestedCapability.get(waitingForNode);
attempts++;
if (attempts >= 10) {
LOGGER.log(Level.INFO, LOGGING_PREFIX + "Request has waited 10 attempts for a node, something " +
if (attempts >= 20) {
LOGGER.log(Level.INFO, LOGGING_PREFIX + "Request has waited 20 attempts for a node, something " +
"went wrong with the previous attempts, creating a new node for {0}.", requestedCapability);
startDockerSeleniumContainer(browserName);
startDockerSeleniumContainer(browserName, true);
requestedCapability.put(waitingForNode, 1);
} else {
requestedCapability.put(waitingForNode, attempts);
Expand Down Expand Up @@ -391,10 +391,14 @@ public float getResourceUsageInPercent() {
return 98;
}

@VisibleForTesting
boolean startDockerSeleniumContainer(String browser) {
return startDockerSeleniumContainer(browser, false);
}

@VisibleForTesting
boolean startDockerSeleniumContainer(String browser, boolean forceCreation) {

if (validateAmountOfDockerSeleniumContainers()) {
if (validateAmountOfDockerSeleniumContainers() || forceCreation) {

String hostIpAddress = "localhost";

Expand Down

0 comments on commit 0b12a99

Please sign in to comment.