Skip to content

Commit

Permalink
[storage] fix: use a different bucket for requester_pays_test (#3655)
Browse files Browse the repository at this point in the history
* [storage] fix: use a different bucket for requester_pays_test

fixes #3654

* rename to README.md, added the envvar to the template

* add REQUESTER_PAYS_TEST_BUCKET env var

* just use REQUESTER_PAYS_TEST_BUCKET
  • Loading branch information
Takashi Matsuo committed Apr 30, 2020
1 parent 0213191 commit dab08ff
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion scripts/decrypt-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ROOT=$( dirname "$DIR" )
# Work from the project root.
cd $ROOT

openssl aes-256-cbc -k "$1" -in testing/secrets.tar.enc -out secrets.tar -d
openssl aes-256-cbc -k "$1" -md sha256 \
-in testing/secrets.tar.enc -out secrets.tar -d
tar xvf secrets.tar
rm secrets.tar
5 changes: 2 additions & 3 deletions scripts/encrypt-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ read -s -p "Enter password for encryption: " PASSWORD
echo

tar cvf secrets.tar testing/{service-account.json,client-secrets.json,test-env.sh}
openssl aes-256-cbc -k "$PASSWORD" -in secrets.tar -out testing/secrets.tar.enc
openssl aes-256-cbc -k "$PASSWORD" -md sha256 \
-in secrets.tar -out testing/secrets.tar.enc
rm secrets.tar

travis encrypt "SECRETS_PASSWORD=$PASSWORD" --add --override
10 changes: 10 additions & 0 deletions storage/cloud-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

For requester_pays_test.py, we need to use a different Storage bucket.

The test looks for an environment variable `REQUESTER_PAYS_TEST_BUCKET`.

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.
4 changes: 3 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,9 @@
import storage_download_file_requester_pays
import storage_get_requester_pays_status

BUCKET = os.environ["CLOUD_STORAGE_BUCKET"]

# We use a different bucket from other tests.
BUCKET = os.environ["REQUESTER_PAYS_TEST_BUCKET"]
PROJECT = os.environ["GCLOUD_PROJECT"]


Expand Down
Binary file modified testing/secrets.tar.enc
Binary file not shown.
1 change: 1 addition & 0 deletions testing/test-env.tmpl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export GOOGLE_CLOUD_PROJECT=$GCLOUD_PROJECT
export FIRESTORE_PROJECT=

export CLOUD_STORAGE_BUCKET=$GCLOUD_PROJECT
export REQUESTER_PAYS_TEST_BUCKET="${CLOUD_STORAGE_BUCKET}-requester-pays-test"
export API_KEY=
export BIGTABLE_CLUSTER=bigtable-test
export BIGTABLE_ZONE=us-central1-c
Expand Down

0 comments on commit dab08ff

Please sign in to comment.