Avoid duplicate /dev/shm bind when reusing BrowserWebDriverContainer#11945
Open
kdelay wants to merge 2 commits into
Open
Avoid duplicate /dev/shm bind when reusing BrowserWebDriverContainer#11945kdelay wants to merge 2 commits into
kdelay wants to merge 2 commits into
Conversation
configure() runs on every start(), and on non-Windows hosts it unconditionally appended a /dev/shm bind to the container binds. When a BrowserWebDriverContainer is stopped and started again (reuse), the bind was added a second time, so container creation failed with "Status 400: Duplicate mount point: /dev/shm". Only add the /dev/shm bind if one is not already present, in both the selenium module container and its deprecated counterpart. Fixes testcontainers#11941 Signed-off-by: kdelay <kdelay20@gmail.com>
|
@kdelay Doesn't that test need a safeguard so that it does not run on Windows. E.g. JUnit's |
The Windows branch of configure() does not add the /dev/shm bind, so the test asserting exactly one /dev/shm bind after two configure() calls would fail on Windows. Guard it with @DisabledOnOs(OS.WINDOWS).
Author
|
Good catch, thanks. Done in f66bd9e - added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Reusing a
BrowserWebDriverContainer(stop, then start again) fails on Linux with:Why
configure()runs on everystart(). On non-Windows hosts it appended a/dev/shmbind to the container binds unconditionally. When the same container instance is started more than once (reuse), the bind was added again, producing a duplicate mount point that Docker rejects at create time.Change
Only add the
/dev/shmbind when one is not already present. Applied to both theorg.testcontainers.selenium.BrowserWebDriverContainerand its deprecatedorg.testcontainers.containers.BrowserWebDriverContainercounterpart, which shared the same logic.Verification
Added
BrowserWebDriverContainerReuseTestwhich callsconfigure()twice (as a reused container would) and asserts a single/dev/shmbind. It fails on the current code (2 binds) and passes with this change. No Docker daemon is required for the test, as it only exercises the container configuration../gradlew :testcontainers-selenium:spotlessCheck :testcontainers-selenium:compileJava :testcontainers-selenium:test --tests "org.testcontainers.selenium.BrowserWebDriverContainerReuseTest"is green.Fixes #11941