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

feat: Document/test the behavior of passing an empty string to SetEnv on Windows #3030

Merged
merged 5 commits into from Sep 3, 2019
Merged

Conversation

ghost
Copy link

@ghost ghost commented Aug 31, 2019

Fixes #3027

This is a quick PR to implement my suggestion. Note that I'm not 100% behind this idea because it may be surprising that the env var isn't actually empty when using SetEnv(var, "") on Windows.

This documents the Windows behavior and adds some tests.

cc @tmatsuo


This change is Reviewable

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 31, 2019
@tmatsuo
Copy link
Contributor

tmatsuo commented Sep 2, 2019

@remyabel Thanks, LGTM, but I'd like to hear from @coryan too.

@tmatsuo tmatsuo requested a review from coryan September 2, 2019 07:33
@tmatsuo
Copy link
Contributor

tmatsuo commented Sep 2, 2019

Maybe you can tweak the title, because it just adds some comments?

@ghost ghost changed the title fix: Fix the behavior of passing an empty string to SetEnv on Windows feat: Document/test the behavior of passing an empty string to SetEnv on Windows Sep 2, 2019
@coryan coryan added the kokoro:run Add this label to force Kokoro to re-run the tests. label Sep 2, 2019
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Sep 2, 2019
@codecov
Copy link

codecov bot commented Sep 2, 2019

Codecov Report

Merging #3030 into master will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3030      +/-   ##
==========================================
+ Coverage   90.88%   90.96%   +0.07%     
==========================================
  Files         300      300              
  Lines       20326    20290      -36     
==========================================
- Hits        18474    18457      -17     
+ Misses       1852     1833      -19
Impacted Files Coverage Δ
google/cloud/storage/oauth2/credentials.h 33.33% <0%> (-33.34%) ⬇️
google/cloud/storage/internal/complex_option.h 66.66% <0%> (-16.67%) ⬇️
...oogle/cloud/bigtable/internal/unary_client_utils.h 84.37% <0%> (-15.63%) ⬇️
google/cloud/storage/internal/curl_handle.h 65.62% <0%> (-12.5%) ⬇️
google/cloud/bigtable/internal/common_client.h 89.47% <0%> (-10.53%) ⬇️
google/cloud/storage/well_known_parameters.h 70% <0%> (-8.89%) ⬇️
google/cloud/storage/well_known_headers.h 77.77% <0%> (-7.41%) ⬇️
...ud/storage/examples/storage_client_mock_samples.cc 86.24% <0%> (-4.24%) ⬇️
google/cloud/storage/internal/generic_request.h 86.48% <0%> (-2.71%) ⬇️
...gle/cloud/storage/internal/curl_request_builder.cc 96.2% <0%> (ø) ⬆️
... and 29 more

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 9ed990b...c5e88fb. Read the comment docs.

@coryan coryan added the kokoro:run Add this label to force Kokoro to re-run the tests. label Sep 3, 2019
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Sep 3, 2019
@coryan
Copy link
Contributor

coryan commented Sep 3, 2019

@remyabel @tmatsuo I definitely do not understand something here, because the tests are failing.

@ghost
Copy link
Author

ghost commented Sep 3, 2019

The tests were failing because I forgot to modify the other tests. I think in the second log this error came up again.

@coryan coryan added the kokoro:run Add this label to force Kokoro to re-run the tests. label Sep 3, 2019
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Sep 3, 2019
Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 4 files at r1, 1 of 2 files at r2.
Reviewable status: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @remyabel)


google/cloud/internal/env_test.cc, line 35 at r3 (raw file):

/// @test Verify we can unset an environment variable with nullptr.
TEST(SetEnv, UnsetEnvWithNullptr) {
  SetEnv("foo", "");

We could simplify this test by using SetEnv("foo", "bar"), right? We already checked that setting to an empty string does the expected thing in the previous test?


google/cloud/internal/env_test.cc, line 47 at r3 (raw file):

/// @test Verify we can unset an environment variable.
TEST(SetEnv, UnsetEnv) {
  SetEnv("foo", "");

Ditto?

@coryan coryan added the kokoro:run Add this label to force Kokoro to re-run the tests. label Sep 3, 2019
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Sep 3, 2019
Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! :lgtm:

Reviewed 1 of 1 files at r4.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@coryan coryan merged commit 563a3ca into googleapis:master Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

internal::SetEnv inconsistent behavior on Windows and other systems
5 participants