-
-
Notifications
You must be signed in to change notification settings - Fork 522
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
Fix race condition while initializing docker client #1160
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Kudos, SonarCloud Quality Gate passed! |
I've thinking about adding the |
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.
LGTM, thanks for fixing the issue that quick!
* chore: add helper function to check if a file exists * chore: wrap the extraction of the current docker host into a reusable function * chore: extract part of the algorithm to calculate the docker socket * chore: use constant for default docker socket in tests * chore: extract docker socket from Go context to a function * chore: reuse constant for default docker socket path * chore: detect DOCKER_HOST first * chore: do not fallback to default, return empty string * chore: apply extract docker host function * chore: read properties with context * docs: document the docker host detection strategies * feat: look up rootless docker if docker host was not found * chore: extract modules generator pipeline * chore: add a pipeline for rootless docker * chore: remove duplicated pipeline * chore: define docekr socket path for unix/windows * chore: convert internal constants into vars for testability * chore: use t.Cleanup to restore test state * feat: support for reading the default docker host from unix/windows * chore: move config to internal package * chore: unify how the docker client is retrieved * chore: delegate singleton instance to the internal config * chore: remove DOCKER_HOST env var from config * chore: support resetting the config singleton for testing * feat: read docker host from properties * fix: typo * fix: remove white lines in imports * fix: handle error in tests * chore: apply #1160 after merge * chore: do not go through the provider to get a client * fix: honour passed Docker client opts * fix: read properties does not consider reading DOCKER_HOST env var * fix: defer client close after docker ping * feat: extract the docker host when bootstrapping a docker client * chore: honour passed opts for the client * chore: cache docker_host to avoid unnecesary calculations * chor: convert socket schema into constants * chore: support parsing URLs for remote hosts * fix: reaper mounts a socket path without schema * fix: proper comment structure for go linting using golangci-lint * chore: get socket mount without schema * fix: support for disabling rootless for testing * fix: get provider host from the strategies * chore: proper separation of concerns between docker socket and docker host * docs: improve docs for Docker host detection * fix: comments indentation * fix: proper list format in Go comments * docs: document rootless socket path alternatives in code * feat: support for testcontainers host strategy * docs: include new strategy in go comment * fix: use tc.host * fix: proper initialisation of baseRunDir * fix: unset DOCKER_HOST for tests that does not need it * chore: do not print config * fix: include schema in the rootless docker socket path * fix: add schema properly * fix: always prepend the schema $XDG_RUNTIME_DIR does not contain it * fix: proper return when sanitising the docker socket path * chore: proper use of docker socket path * chore: defensively restore env var in tests * fix: make sure the already built image is removed from the local cache * fix: use testcontainers docker client when removing image * fix: update docs * chore: rename variable * fix: add back module generator tests * chore: do not break users for the deprecated fields in the tc config * fix: tc.host takes precedence on TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE for the docker socket
What does this PR do?
After updating the dependency in my project from
v0.19.0
tov0.20.0
, I get this error while running the testsThe root cause is
tcConfig = ReadConfig()
,tcConfig
is a private global variable and is initialized in theReadConfig()
. The one inNewDockerClient()
should be a local variable instead.Why is it important?
The testcontainers should be running without a race condition
Related issues
n/a