Skip to content

Commit 5a311a2

Browse files
renovate-botTakashi Matsuo
authored andcommitted
chore(deps): update dependency google-cloud-storage to v1.28.1 [(#3785)](#3785)
* chore(deps): update dependency google-cloud-storage to v1.28.1 * [asset] testing: use uuid instead of time Co-authored-by: Takashi Matsuo <[email protected]>
1 parent c71b19b commit 5a311a2

8 files changed

+37
-31
lines changed

asset/snippets/snippets/quickstart_batchgetassetshistory_test.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
# limitations under the License.
1616

1717
import os
18-
import time
18+
import uuid
1919

20+
import backoff
21+
from google.api_core.exceptions import InvalidArgument
2022
from google.cloud import storage
2123
import pytest
2224

2325
import quickstart_batchgetassetshistory
2426

2527
PROJECT = os.environ['GCLOUD_PROJECT']
26-
BUCKET = 'assets-{}'.format(int(time.time()))
28+
BUCKET = 'assets-{}'.format(uuid.uuid4().hex)
2729

2830

2931
@pytest.fixture(scope='module')
@@ -47,12 +49,15 @@ def asset_bucket(storage_client):
4749
def test_batch_get_assets_history(asset_bucket, capsys):
4850
bucket_asset_name = '//storage.googleapis.com/{}'.format(BUCKET)
4951
asset_names = [bucket_asset_name, ]
50-
# There's some delay between bucket creation and when it's reflected in the
51-
# backend.
52-
time.sleep(15)
53-
quickstart_batchgetassetshistory.batch_get_assets_history(
54-
PROJECT, asset_names)
55-
out, _ = capsys.readouterr()
56-
57-
if not out:
52+
53+
@backoff.on_exception(
54+
backoff.expo, (AssertionError, InvalidArgument), max_time=30
55+
)
56+
def eventually_consistent_test():
57+
quickstart_batchgetassetshistory.batch_get_assets_history(
58+
PROJECT, asset_names)
59+
out, _ = capsys.readouterr()
60+
5861
assert bucket_asset_name in out
62+
63+
eventually_consistent_test()

asset/snippets/snippets/quickstart_createfeed_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import json
1818
import os
19-
import time
19+
import uuid
2020

2121
from google.cloud import pubsub_v1
2222
from google.cloud import resource_manager
@@ -27,9 +27,9 @@
2727
json_data = open(os.environ["GOOGLE_APPLICATION_CREDENTIALS"]).read()
2828
data = json.loads(json_data)
2929
PROJECT = data['project_id']
30-
ASSET_NAME = 'assets-{}'.format(int(time.time()))
31-
FEED_ID = 'feed-{}'.format(int(time.time()))
32-
TOPIC = 'topic-{}'.format(int(time.time()))
30+
ASSET_NAME = 'assets-{}'.format(uuid.uuid4().hex)
31+
FEED_ID = 'feed-{}'.format(uuid.uuid4().hex)
32+
TOPIC = 'topic-{}'.format(uuid.uuid4().hex)
3333

3434

3535
def test_create_feed(capsys):

asset/snippets/snippets/quickstart_deletefeed_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
import os
18-
import time
18+
import uuid
1919

2020
from google.cloud import pubsub_v1
2121
from google.cloud import resource_manager
@@ -24,9 +24,9 @@
2424
import quickstart_deletefeed
2525

2626
PROJECT = os.environ['GCLOUD_PROJECT']
27-
ASSET_NAME = 'assets-{}'.format(int(time.time()))
28-
FEED_ID = 'feed-{}'.format(int(time.time()))
29-
TOPIC = 'topic-{}'.format(int(time.time()))
27+
ASSET_NAME = 'assets-{}'.format(uuid.uuid4().hex)
28+
FEED_ID = 'feed-{}'.format(uuid.uuid4().hex)
29+
TOPIC = 'topic-{}'.format(uuid.uuid4().hex)
3030

3131

3232
def test_delete_feed(capsys):

asset/snippets/snippets/quickstart_exportassets_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
# limitations under the License.
1616

1717
import os
18-
import time
18+
import uuid
1919

2020
from google.cloud import storage
2121
import pytest
2222

2323
import quickstart_exportassets
2424

2525
PROJECT = os.environ['GCLOUD_PROJECT']
26-
BUCKET = 'assets-{}'.format(int(time.time()))
26+
BUCKET = 'assets-{}'.format(uuid.uuid4().hex)
2727

2828

2929
@pytest.fixture(scope='module')

asset/snippets/snippets/quickstart_getfeed_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
import os
18-
import time
18+
import uuid
1919

2020
from google.cloud import pubsub_v1
2121
from google.cloud import resource_manager
@@ -25,9 +25,9 @@
2525
import quickstart_getfeed
2626

2727
PROJECT = os.environ['GCLOUD_PROJECT']
28-
ASSET_NAME = 'assets-{}'.format(int(time.time()))
29-
FEED_ID = 'feed-{}'.format(int(time.time()))
30-
TOPIC = 'topic-{}'.format(int(time.time()))
28+
ASSET_NAME = 'assets-{}'.format(uuid.uuid4().hex)
29+
FEED_ID = 'feed-{}'.format(uuid.uuid4().hex)
30+
TOPIC = 'topic-{}'.format(uuid.uuid4().hex)
3131

3232

3333
def test_get_feed(capsys):

asset/snippets/snippets/quickstart_updatefeed_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
import os
18-
import time
18+
import uuid
1919

2020
from google.cloud import pubsub_v1
2121
from google.cloud import resource_manager
@@ -25,10 +25,10 @@
2525
import quickstart_updatefeed
2626

2727
PROJECT = os.environ['GCLOUD_PROJECT']
28-
ASSET_NAME = 'assets-{}'.format(int(time.time()))
29-
FEED_ID = 'feed-{}'.format(int(time.time()))
30-
TOPIC = 'topic-{}'.format(int(time.time()))
31-
NEW_TOPIC = 'new-topic-{}'.format(int(time.time()))
28+
ASSET_NAME = 'assets-{}'.format(uuid.uuid4().hex)
29+
FEED_ID = 'feed-{}'.format(uuid.uuid4().hex)
30+
TOPIC = 'topic-{}'.format(uuid.uuid4().hex)
31+
NEW_TOPIC = 'new-topic-{}'.format(uuid.uuid4().hex)
3232

3333

3434
def test_update_feed(capsys):
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
pytest==5.3.2
1+
backoff==1.10.0
2+
pytest==5.4.1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
google-cloud-storage==1.28.0
1+
google-cloud-storage==1.28.1
22
google-cloud-asset==0.10.0
33
google-cloud-resource-manager==0.30.1
44
google-cloud-pubsub==1.4.3

0 commit comments

Comments
 (0)