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

test(storage): add test for uploading with an emulator #4641

Merged
merged 34 commits into from
Aug 30, 2021

Conversation

BrennaEpp
Copy link
Contributor

@BrennaEpp BrennaEpp commented Aug 18, 2021

This test should catch an error such as #2476
Also added tests to ensure endpoint overrides emulator host when host is specified as host:port or scheme://host:port - this adds extra coverage to ensure something like #4444 does not occur again

@BrennaEpp BrennaEpp requested a review from a team August 18, 2021 21:24
@BrennaEpp BrennaEpp requested a review from a team as a code owner August 18, 2021 21:24
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Aug 18, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 18, 2021
storage/storage_test.go Show resolved Hide resolved
}
ctx := context.Background()
for _, tc := range testCases {
os.Setenv("STORAGE_EMULATOR_HOST", tc.StorageEmulatorHost)
Copy link
Contributor

Choose a reason for hiding this comment

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

This will change the value of the env var on the system (and mess up subsequent integration tests). You should capture the existing value for this in a variable and defer a call to restore the value to what it originally was.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that's what I'm doing on line 1368 and 1369

storage/storage_test.go Outdated Show resolved Hide resolved
storage/storage_test.go Outdated Show resolved Hide resolved
storage/storage_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tritone tritone left a comment

Choose a reason for hiding this comment

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

Looks good! Two small things.

storage/storage_test.go Outdated Show resolved Hide resolved
storage/storage_test.go Outdated Show resolved Hide resolved
@BrennaEpp BrennaEpp requested a review from tritone August 24, 2021 00:20
Copy link
Contributor

@tritone tritone left a comment

Choose a reason for hiding this comment

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

Very nice addition!

case <-timeout:
t.Errorf("test timeout")
timedOut <- true
case <-done:
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably could've used a WaitGroup (this is fine though!)

@BrennaEpp BrennaEpp merged commit b8475b0 into googleapis:master Aug 30, 2021
@BrennaEpp BrennaEpp deleted the add-emulator-ops-test branch August 30, 2021 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants