File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,12 @@ def delete_bucket(bucket):
111111 retry (bucket .delete )(force = True )
112112
113113
114- def await_config_changes_propagate (sec = 3 ):
114+ def await_config_changes_propagate (sec = 12 ):
115115 # Changes to the bucket will be readable immediately after writing,
116116 # but configuration changes may take time to propagate.
117117 # See https://cloud.google.com/storage/docs/json_api/v1/buckets/patch
118+ #
119+ # The default was changed from 3 to 12 in May 2023 due to changes in bucket
120+ # metadata handling. Note that the documentation recommends waiting "30
121+ # seconds".
118122 time .sleep (sec )
Original file line number Diff line number Diff line change 4444 "parent/child/other/file32.txt" ,
4545]
4646
47+ ebh_bucket_iteration = 0
48+
4749
4850@pytest .fixture (scope = "session" )
4951def storage_client ():
@@ -165,12 +167,20 @@ def signing_bucket(storage_client, signing_bucket_name):
165167 _helpers .delete_bucket (bucket )
166168
167169
168- @pytest .fixture (scope = "session " )
170+ @pytest .fixture (scope = "function " )
169171def default_ebh_bucket_name ():
170- return _helpers .unique_name ("gcp-systest-default-ebh" )
172+ # Keep track of how many ebh buckets have been created so we can get a
173+ # clean one each rerun. "unique_name" is unique per test iteration, not
174+ # per test rerun.
175+ global ebh_bucket_iteration
176+ ebh_bucket_iteration += 1
177+ return _helpers .unique_name ("gcp-systest-default-ebh" ) + "-{}" .format (
178+ ebh_bucket_iteration
179+ )
171180
172181
173- @pytest .fixture (scope = "session" )
182+ # ebh_bucket/name are not scope=session because the bucket is modified in test.
183+ @pytest .fixture (scope = "function" )
174184def default_ebh_bucket (storage_client , default_ebh_bucket_name ):
175185 bucket = storage_client .bucket (default_ebh_bucket_name )
176186 bucket .default_event_based_hold = True
Original file line number Diff line number Diff line change @@ -920,6 +920,9 @@ def test_new_bucket_created_w_inherited_pap(
920920
921921 bucket .iam_configuration .uniform_bucket_level_access_enabled = False
922922 bucket .patch ()
923+
924+ _helpers .await_config_changes_propagate ()
925+
923926 assert (
924927 bucket .iam_configuration .public_access_prevention
925928 == constants .PUBLIC_ACCESS_PREVENTION_ENFORCED
You can’t perform that action at this time.
0 commit comments