fix: data race in docker client Info()#1779
Conversation
There was a problem hiding this comment.
Thanks @pmalek for your contribution. I was not expecting the data race, but I could have screwed it up with the sync.Once. In any case, this PR is changing the expected behaviour of our Info method, as we want to cache it for every test session, and by test session we mean a "go test" execution.
If the data race is there, no doubt about it, please try to keep the Info cached for the entire test session, not for each docker client instance.
Thanks in advance, and please let me know if I can explain anything else with more details 🙏
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
BTW from the above log I imagine you are starting a Kong container, right? Do you know @gAmUssA created a Kong module? https://github.com/gAmUssA/testcontainers-go-kong/ You could give it a try 🤔 |
Yes, we are starting kong. This module is indeed a more fully fledged version of what we're using and we are considering merging the efforts into one. Thanks for the pointer though! |
mdelapenya
left a comment
There was a problem hiding this comment.
LGTM, thanks for your time debugging race conditions. They are always hard to find and hard to fix. 🙇
* main: fix: data race in docker client `Info()` (testcontainers#1779) Use correct formatting directive for errors in lifecycle logs (testcontainers#1780) chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (testcontainers#1778) chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (testcontainers#1728) chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (testcontainers#1732) ignore patterns defined in dockerignore (testcontainers#1725)
* main: (27 commits) docs: remove OpenSSF scorecard (#1823) Auto-cleanup of k6 build cache (#1788) Add OpenSSF Scorecards GitHub Action (#1795) chore(deps): bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#1822) chore: expose SessionID (#1793) chore: use HTTP calls to invoke the lambda from the tests (#1794) wait for log producer to really stop inside StopLogProducer func (#1701) chore(deps): bump github.com/nats-io/nats-server/v2 in /modules/nats (#1784) chore(deps): bump urllib3 from 2.0.6 to 2.0.7 (#1781) chore: add an example of using localstack alongside AWS lambdas (#1790) chore(deps): combine and bump compose dependencies (#1787) feat: support for replacing images with custom substitutions (#1719) fix: data race in docker client `Info()` (#1779) Use correct formatting directive for errors in lifecycle logs (#1780) chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (#1778) chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (#1728) chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (#1732) ignore patterns defined in dockerignore (#1725) Fix wrong module names (#1776) docs: add default options to k6 module (#1744) ...
…ers/image-spec-1.1.0-rc5 * main: (49 commits) docs: remove OpenSSF scorecard (#1823) Auto-cleanup of k6 build cache (#1788) Add OpenSSF Scorecards GitHub Action (#1795) chore(deps): bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#1822) chore: expose SessionID (#1793) chore: use HTTP calls to invoke the lambda from the tests (#1794) wait for log producer to really stop inside StopLogProducer func (#1701) chore(deps): bump github.com/nats-io/nats-server/v2 in /modules/nats (#1784) chore(deps): bump urllib3 from 2.0.6 to 2.0.7 (#1781) chore: add an example of using localstack alongside AWS lambdas (#1790) chore(deps): combine and bump compose dependencies (#1787) feat: support for replacing images with custom substitutions (#1719) fix: data race in docker client `Info()` (#1779) Use correct formatting directive for errors in lifecycle logs (#1780) chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (#1778) chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (#1728) chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (#1732) ignore patterns defined in dockerignore (#1725) Fix wrong module names (#1776) docs: add default options to k6 module (#1744) ...
What does this PR do?
This fixes a data race in docker client
Info()which occurs when e.g. docker socket is unreachable:Why is it important?
It's nice to not have data races in code.
Related issues
How to test this PR