Skip to content
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: reset config in tests #1516

Merged
merged 2 commits into from
Aug 23, 2023
Merged

Conversation

mdelapenya
Copy link
Member

What does this PR do?

It resets the config synchronisation (sync.Once) in order to not affect other tests.

Why is it important?

I found this issue as a side effect of debugging another thing, and it took me a couple of hours to understand that the testcontainers.properties file was empty because somebody in the test execution called the ReadConfig() method, initialising the sync.Once that protects from multiple reads of the config.

I noticed the HOME variable was empty when reading the Docker Host, os.UserHomeDir returned an error, and that led me to identify the config as the culprit. Following the rabbot hole I found there were two tests reading the config but not resetting the original state (only available for internal use of the library), and this PR fixes that.

@mdelapenya mdelapenya requested a review from a team as a code owner August 23, 2023 07:59
@mdelapenya mdelapenya added the bug An issue with the library label Aug 23, 2023
@mdelapenya mdelapenya self-assigned this Aug 23, 2023
@netlify
Copy link

netlify bot commented Aug 23, 2023

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 3d9709a
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/64e5c84ce46ca700081ebc21
😎 Deploy Preview https://deploy-preview-1516--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mdelapenya mdelapenya added chore Changes that do not impact the existing functionality and removed bug An issue with the library labels Aug 23, 2023
kiview
kiview previously approved these changes Aug 23, 2023
@sonarcloud
Copy link

sonarcloud bot commented Aug 23, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mdelapenya mdelapenya merged commit b914c67 into testcontainers:main Aug 23, 2023
116 checks passed
@mdelapenya mdelapenya deleted the fix-reset-config branch August 23, 2023 09:52
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Aug 23, 2023
mdelapenya added a commit to igribkov/testcontainers-go that referenced this pull request Aug 28, 2023
* main: (26 commits)
  modulegen: create internal/make (testcontainers#1537)
  chore: fix workflow (testcontainers#1538)
  chore(deps): bump the all group in /examples/cockroachdb with 1 update (testcontainers#1522)
  chore(deps): bump the all group in /examples/bigtable with 1 update (testcontainers#1534)
  chore(deps): bump the all group in /modules/localstack with 4 updates (testcontainers#1535)
  chore(deps): bump the all group in /modules/k3s with 2 updates (testcontainers#1526)
  chore(deps): bump the all group in /examples/spanner with 2 updates (testcontainers#1532)
  chore(deps): bump the all group in /examples/firestore with 1 update (testcontainers#1523)
  chore(deps): bump the all group in /modules/redis with 1 update (testcontainers#1524)
  chore(deps): bump the all group in /modules/clickhouse with 1 update (testcontainers#1525)
  chore(deps): bump the all group in /examples/toxiproxy with 2 updates (testcontainers#1528)
  chore(deps): bump the all group in /examples/pubsub with 1 update (testcontainers#1531)
  chore(deps): bump the all group in /examples/datastore with 2 updates (testcontainers#1530)
  chore(deps): bump the all group in /modules/redpanda with 1 update (testcontainers#1527)
  chore: properly render mkdocs.yml (testcontainers#1521)
  modulegen: create internal/workflow (testcontainers#1520)
  modulegen: create internal/module (testcontainers#1505)
  modulegen: create internal/mkdocs (testcontainers#1504)
  fix: do not remove the file schema in docker.host property (testcontainers#1517)
  fix: reset config in tests (testcontainers#1516)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Changes that do not impact the existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants