Skip to content

Commit 9239c3c

Browse files
authored
Merge pull request #2307 from dhermes/logging-flaky-sys-test
Adding retry for bucket creation to logging system test.
2 parents 731a2cc + 7eb3177 commit 9239c3c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

system_tests/logging_.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import logging
1616
import unittest
1717

18+
from google.cloud.exceptions import TooManyRequests
1819
import google.cloud.logging
1920
import google.cloud.logging.handlers.handlers
2021
from google.cloud.logging.handlers.handlers import CloudLoggingHandler
@@ -28,6 +29,7 @@
2829
_RESOURCE_ID = unique_resource_id('-')
2930
DEFAULT_FILTER = 'logName:syslog AND severity>=INFO'
3031
DEFAULT_DESCRIPTION = 'System testing'
32+
retry_429 = RetryErrors(TooManyRequests)
3133

3234

3335
def _retry_on_unavailable(exc):
@@ -291,7 +293,8 @@ def _init_storage_bucket(self):
291293
# Create the destination bucket, and set up the ACL to allow
292294
# Stackdriver Logging to write into it.
293295
storage_client = storage.Client()
294-
bucket = storage_client.create_bucket(BUCKET_NAME)
296+
bucket = storage_client.bucket(BUCKET_NAME)
297+
retry_429(bucket.create)()
295298
self.to_delete.append(bucket)
296299
bucket.acl.reload()
297300
logs_group = bucket.acl.group('cloud-logs@google.com')

0 commit comments

Comments
 (0)