testcontainers / testcontainers/testcontainers-java

Add ability to increase default timeout for BrowserWebDriverContainer when checking if it's started

Open
#3,161 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

Hi, seems that on some slow agents we might be hitting the 30s hardcoded timeout. While we can extend BrowserWebDriverContainer to override containerIsStarted() (it's not perfect though since we cannot just copy paste the default content as it uses some private variables), it would be even nicer if the timeout could be configurable.

I'm referring to:

    protected void containerIsStarted(InspectContainerResponse containerInfo) {
        this.driver = (RemoteWebDriver)Unreliables.retryUntilSuccess(30, TimeUnit.SECONDS, (Callable)Timeouts.getWithTimeout(10, TimeUnit.SECONDS, () -> {
            return () -> {
                return new RemoteWebDriver(this.getSeleniumAddress(), this.capabilities);
            };
        }));
        if (this.vncRecordingContainer != null) {
            LOGGER.debug("Starting VNC recording");
            this.vncRecordingContainer.start();
        }

    }

What I did FTR:

public class XWikiBrowserWebDriverContainer<T extends BrowserWebDriverContainer<T>> extends BrowserWebDriverContainer<T>
{
    private Capabilities capabilities;

    @Override
    protected void containerIsStarted(InspectContainerResponse containerInfo)
    {
        Unreliables.retryUntilSuccess(60, TimeUnit.SECONDS,
            Timeouts.getWithTimeout(20, TimeUnit.SECONDS,
                () -> () -> new RemoteWebDriver(this.getSeleniumAddress(), this.capabilities)));
        super.containerIsStarted(containerInfo);
    }

    @Override
    public T withCapabilities(Capabilities capabilities)
    {
        this.capabilities = capabilities;
        return super.withCapabilities(capabilities);
    }
}

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with BrowserWebDriverContainer.containerIsStarted and the retry and driver-creation path shown in the issue. Trace how withCapabilities and the private state are used, then locate the existing container startup tests before making the timeout configurable. Done means slow agents can override the startup wait without copying private implementation details.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.