GeezerVison is showing github.com — Add system tests for bucket notifications. by tseaver · Pull Request #4021 · googleapis/google-cloud-python
Conversation
tseaver
commented
Sep 21, 2017
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
N.B.: the tests currently fail with a 403:
____________ TestStorageNotificationCRUD.test_notification_explicit ____________
Traceback (most recent call last):
File "/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/tests/system.py", line 628, in test_notification_explicit
retry_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", line 95, in wrapped_function
return to_wrap(*args, **kwargs)
File "/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/google/cloud/storage/notification.py", line 243, in create
data=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", line 293, in api_request
raise exceptions.from_http_response(response)
google.api.core.exceptions.Forbidden: 403 POST https://www.googleapis.com/storage/v1/b/notification-explicit-1506029348265/notificationConfigs: The service account '[email protected]' does not have permission to publish messages to to the Cloud Pub/Sub topic '//pubsub.googleapis.com/projects/precise-truck-742/topics/notification-1506029282321', or that topic does not exist.
____________ TestStorageNotificationCRUD.test_notification_minimal _____________
Traceback (most recent call last):
File "/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/tests/system.py", line 607, in test_notification_minimal
retry_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", line 95, in wrapped_function
return to_wrap(*args, **kwargs)
File "/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/google/cloud/storage/notification.py", line 243, in create
data=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", line 293, in api_request
raise exceptions.from_http_response(response)
google.api.core.exceptions.Forbidden: 403 POST https://www.googleapis.com/storage/v1/b/notification-minimal-1506029351126/notificationConfigs: The service account '[email protected]' does not have permission to publish messages to to the Cloud Pub/Sub topic '//pubsub.googleapis.com/projects/precise-truck-742/topics/notification-1506029282321', or that topic does not exist.
See #3956 https://github.com/GoogleCloudPlatform/google-cloud-common/issues/231 where I ask for help on that issue.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
session.install('../test_utils/')
|
|
|
session.install('.')
|
|
|
session.install('../pubsub')
|
|
|
session.install('-e', '.')
|
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
self.assertEqual(len(notifications), 1)
|
|
|
self.assertEqual(notifications[0].topic_name, self.TOPIC_NAME)
|
|
|
finally:
|
|
|
notification.delete()
|
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
tseaver
changed the title
WIP: Add system tests for bucket notifications.
Add system tests for bucket notifications.
Sep 22, 2017
|
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).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
tseaver
commented
Sep 22, 2017
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
N.B.: the tests currently fail with a 403.
The back-end uses 'object_name_prefix'.
|
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
2 more reviewers
dhermes
dhermes left review comments
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
api: storage
Issues related to the Cloud Storage API.
cla: yes
This human has signed the Contributor License Agreement.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|