Skip to content

Add system tests for bucket notifications. - #4021

Merged
tseaver merged 6 commits into
googleapis:3956-storage-notificationsfrom
tseaver:3956-storage-notifications-systest
Oct 5, 2017
Merged

Add system tests for bucket notifications.#4021
tseaver merged 6 commits into
googleapis:3956-storage-notificationsfrom
tseaver:3956-storage-notifications-systest

Conversation

@tseaver

@tseavertseaver commented Sep 21, 2017

Copy link
Copy Markdown
Contributor

N.B.: the tests currently fail with a 403:

____________TestStorageNotificationCRUD.test_notification_explicit____________Traceback (mostrecentcalllast):
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/tests/system.py", line628, intest_notification_explicitretry_429(notification.create)()
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/.nox/sys-3-6/lib/python3.6/site-packages/test_utils/retry.py", line95, inwrapped_functionreturnto_wrap(*args, **kwargs)
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/google/cloud/storage/notification.py", line243, increatedata=properties,
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/.nox/sys-3-6/lib/python3.6/site-packages/google/cloud/_http.py", line293, inapi_requestraiseexceptions.from_http_response(response)
google.api.core.exceptions.Forbidden: 403POSThttps://www.googleapis.com/storage/v1/b/notification-explicit-1506029348265/notificationConfigs: Theserviceaccount'precise-truck-742@gs-project-accounts.iam.gserviceaccount.com'doesnothavepermissiontopublishmessagestototheCloudPub/Subtopic'//pubsub.googleapis.com/projects/precise-truck-742/topics/notification-1506029282321', orthattopicdoesnotexist.
____________TestStorageNotificationCRUD.test_notification_minimal_____________Traceback (mostrecentcalllast):
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/tests/system.py", line607, intest_notification_minimalretry_429(notification.create)()
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/.nox/sys-3-6/lib/python3.6/site-packages/test_utils/retry.py", line95, inwrapped_functionreturnto_wrap(*args, **kwargs)
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/google/cloud/storage/notification.py", line243, increatedata=properties,
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/.nox/sys-3-6/lib/python3.6/site-packages/google/cloud/_http.py", line293, inapi_requestraiseexceptions.from_http_response(response)
google.api.core.exceptions.Forbidden: 403POSThttps://www.googleapis.com/storage/v1/b/notification-minimal-1506029351126/notificationConfigs: Theserviceaccount'precise-truck-742@gs-project-accounts.iam.gserviceaccount.com'doesnothavepermissiontopublishmessagestototheCloudPub/Subtopic'//pubsub.googleapis.com/projects/precise-truck-742/topics/notification-1506029282321', orthattopicdoesnotexist.

See #3956https://github.com/GoogleCloudPlatform/google-cloud-common/issues/231 where I ask for help on that issue.

@tseavertseaver added api: storage Issues related to the Cloud Storage API. do not merge Indicates a pull request not ready for merge, due to either quality or timing. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Sep 21, 2017
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 21, 2017

@dhermesdhermes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No real complaints here

Comment threadstorage/nox.py
session.install('../test_utils/')
session.install('.')
session.install('../pubsub')
session.install('-e', '.')

This comment was marked as spam.

This comment was marked as spam.

with Config.CLIENT.batch():
for bucket_name in self.case_buckets_to_delete:
bucket = Config.CLIENT.bucket(bucket_name)
retry_429(bucket.delete)()

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

self.assertEqual(len(notifications), 1)
self.assertEqual(notifications[0].topic_name, self.TOPIC_NAME)
finally:
notification.delete()

This comment was marked as spam.

This comment was marked as spam.

self.assertIsNotNone(notification.id)
notifications = list(bucket.list_notifications())
self.assertEqual(len(notifications), 1)
self.assertEqual(notifications[0].topic_name, self.TOPIC_NAME)

This comment was marked as spam.

This comment was marked as spam.

@tseavertseaver changed the title WIP: Add system tests for bucket notifications.Add system tests for bucket notifications.Sep 22, 2017
@tseavertseaver removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Sep 22, 2017
@tseaver

Copy link
Copy Markdown
ContributorAuthor

7d9ee94 updates the notification system tests, adding the IAM grant to the topic required to allow creation of the notification. Those tests are now passing (61c5d0f and da6dc1c fix bugs uncovered by running them).

@tseaver

tseaver commented Sep 22, 2017

Copy link
Copy Markdown
ContributorAuthor

Branch build with new system tests passes the storage system tests. CircleCI failures are unrelated vision flakiness (#4035)

@tseaver
tseaverforce-pushed the 3956-storage-notifications branch from 9eb9a46 to 352aeedCompareSeptember 25, 2017 15:32
@tseaver

Copy link
Copy Markdown
ContributorAuthor

I rebased the target branch against master after the merge of #4050, and rebased this PR's branch against that branch: here's hoping the "dandruff shampoo" worked.

policy = self.publisher_client.get_iam_policy(self.topic_path)
binding = policy.bindings.add()
binding.role = 'roles/pubsub.publisher'
binding.members.append(

This comment was marked as spam.

@tseaver
tseaver merged commit 978eb0f into googleapis:3956-storage-notificationsOct 5, 2017
@tseaver
tseaver deleted the 3956-storage-notifications-systest branch October 5, 2017 17:34
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storageIssues related to the Cloud Storage API.cla: yesThis human has signed the Contributor License Agreement.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@tseaver@dhermes@BrandonY@googlebot