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

[storage] fix: use a different bucket for requester_pays_test #3655

Merged
merged 4 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions storage/cloud-client/README_TEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

tmatsuo marked this conversation as resolved.
Show resolved Hide resolved
For requester_pays_test.py, we need to use a different Storage bucket.

The test looks for an environment variable
`REQUESTER_PAYS_TEST_BUCKET` first and then fallback to
`${CLOUD_STORAGE_BUCKET} + '-requester-pays-test'`.

On the test project, we created a bucket named
`python-docs-samples-tests-requester-pays-test`.


Also, the service account for the test needs to have `Billing Project
Manager` role in order to make changes on buckets with requester pays
enabled.

We added that role to the test service account.
9 changes: 8 additions & 1 deletion storage/cloud-client/requester_pays_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
import storage_download_file_requester_pays
import storage_get_requester_pays_status

BUCKET = os.environ["CLOUD_STORAGE_BUCKET"]

# We should not use the same bucket as other tests are using.
# First look at REQUESTER_PAYS_TEST_BUCKET and fall back to
tmatsuo marked this conversation as resolved.
Show resolved Hide resolved
# ${CLOUD_STORAGE_BUCKET} + '-requester-pays-test'.
BUCKET = os.environ.get(
"REQUESTER_PAYS_TEST_BUCKET",
tmatsuo marked this conversation as resolved.
Show resolved Hide resolved
"{}-requester-pays-test".format(os.environ["CLOUD_STORAGE_BUCKET"])
)
PROJECT = os.environ["GCLOUD_PROJECT"]


Expand Down