-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Switch browser containers to use LogMessageWaitStrategy #328
Conversation
FYI @kiview |
|
||
// Use multiple startup attempts due to race condition between Selenium being available and VNC being available | ||
VncRecordingSidekickContainer recordingSidekickContainer = new VncRecordingSidekickContainer<>(this) | ||
.withStartupAttempts(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. this has become necessary because we're now much quicker at starting the WebDriver connection; it exposes a race condition against the VNC socket.
In my testing this led to ~5% of tests randomly failing due to the vnc recorder getting 'Connection Refused'.
Adding multiple startup attempts for the VNC recorder resolves the issue; we could potentially include a wait in the VNC recorder (or here), but that adds a bit more complexity.
|
||
@Test | ||
public void simpleTest() throws IOException { | ||
doSimpleWebdriverTest(chromeWithCustomTimeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No assertion in this test unfortunately; I couldn't think of a way to do it that wasn't over-engineered. In manual testing I've dialled this right down to 1 second to verify that the timeout is having an effect.
|
||
logger().info("Obtained a connection to container ({})", BrowserWebDriverContainer.this.getSeleniumAddress()); | ||
return driver; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can avoid having all this code, which is nice.
234215b
to
4ec0001
Compare
4ec0001
to
564583e
Compare
Reduces default browser container startup timeout to 15s, down from an unnecessarily high 120s. This also replaces inheritance-based `waitUntilContainerStarted` with composition-based `WaitStrategy`. The new `LogMessageWaitStrategy` allows us to wait based upon the Selenium container log output, rather than the relatively expensive process of repeatedly trying to create and connect a `RemoteWebDriver` instance.
…iner This change makes docker-java NO LONGER SHADED into testcontainers core JAR
144e7ee
to
c962b0f
Compare
Argh, there's a problem with this - I think that at some point before v3.4.0 of selenium the readiness text changed. Might need a regex update.... |
Reduces default browser container startup timeout to 15s, down from an
unnecessarily high 120s.
This also replaces inheritance-based
waitUntilContainerStarted
withcomposition-based
WaitStrategy
. The newLogMessageWaitStrategy
allowsus to wait based upon the Selenium container log output, rather than the
relatively expensive process of repeatedly trying to create and connect
a
RemoteWebDriver
instance.