Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time limit and retry to instantiation of RemoteWebDriver #381

Merged
merged 3 commits into from
Jun 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
- Fixed the case when disk's size is bigger than Integer's max value (#379, #380)
- Fix erroneous version reference used during CI testing of shaded dependencies
- Fix leakage of Vibur and Tomcat JDBC test dependencies in `jdbc-test` and `mysql` modules (#382)
- Add timeout and retries for creation of `RemoteWebDriver` (#381, #373, #257)

### Changed
- Added support for Docker networks (#372)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.rnorth.ducttape.timeouts.Timeouts;
import org.rnorth.ducttape.unreliables.Unreliables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.traits.LinkableContainer;
Expand All @@ -20,6 +22,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.concurrent.TimeUnit;

import static com.google.common.base.Preconditions.checkState;
import static java.time.temporal.ChronoUnit.SECONDS;
Expand Down Expand Up @@ -157,7 +160,11 @@ protected void containerIsStarted(InspectContainerResponse containerInfo) {
recordingSidekickContainer.start();
currentVncRecordings.add(recordingSidekickContainer);
}
this.driver = new RemoteWebDriver(getSeleniumAddress(), desiredCapabilities);

driver = Unreliables.retryUntilSuccess(30, TimeUnit.SECONDS,
Timeouts.getWithTimeout(10, TimeUnit.SECONDS,
() ->
() -> new RemoteWebDriver(getSeleniumAddress(), desiredCapabilities)));
}

/**
Expand Down