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

refactor: more nuanced env vs properties config #479

Merged
merged 1 commit into from
Jul 5, 2022

Conversation

zregvart
Copy link
Contributor

@zregvart zregvart commented Jul 5, 2022

The environment variables should trump configuration from $HOME/.testcontainers.properties file, but only if they're set and then only if they equal true or false. This refactors configureTC to make sure that environment variables are always considered and indeed trump any configuration in $HOME/.testcontainers.properties file, even as parsing the configuration from $HOME/.testcontainers.properties completes partially. Also the HOME is not set test cases now do not set the $HOME so that the os.UserHomeDir error path is exercised by the tests.

@codecov
Copy link

codecov bot commented Jul 5, 2022

Codecov Report

Merging #479 (e2ec1af) into main (b5ff9a2) will increase coverage by 0.14%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
+ Coverage   69.79%   69.94%   +0.14%     
==========================================
  Files          21       21              
  Lines        1947     1950       +3     
==========================================
+ Hits         1359     1364       +5     
+ Misses        472      470       -2     
  Partials      116      116              
Impacted Files Coverage Δ
docker.go 70.88% <100.00%> (+0.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5ff9a2...e2ec1af. Read the comment docs.

docker.go Outdated Show resolved Hide resolved
The environment variables should trump configuration from
`$HOME/.testcontainers.properties` file, but only if they're set and
then only if they equal `true` or `false`. This refactors `configureTC`
to make sure that environment variables are always considered and indeed
trump any configuration in `$HOME/.testcontainers.properties` file, even
as parsing the configuration from `$HOME/.testcontainers.properties`
completes partially. Also the `HOME is not set` test cases now do not
set the `$HOME` so that the `os.UserHomeDir` error path is exercised
by the tests.
@mdelapenya mdelapenya added the chore Changes that do not impact the existing functionality label Jul 5, 2022
@mdelapenya mdelapenya self-assigned this Jul 5, 2022
@mdelapenya mdelapenya merged commit 429a4c8 into testcontainers:main Jul 5, 2022
@zregvart zregvart deleted the pr/nuanced-config branch July 5, 2022 13:02
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.

None yet

2 participants