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.
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.
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.
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
waitUntilContainerStartedwithcomposition-based
WaitStrategy. The newLogMessageWaitStrategyallowsus to wait based upon the Selenium container log output, rather than the
relatively expensive process of repeatedly trying to create and connect
a
RemoteWebDriverinstance.