@@ -59,6 +59,7 @@ const RUNNING_IN_VPCSC = !!process.env['GOOGLE_CLOUD_TESTS_IN_VPCSC'];
59
59
60
60
const UNIFORM_ACCESS_TIMEOUT = 60 * 1000 ; // 60s see: https://cloud.google.com/storage/docs/consistency#eventually_consistent_operations
61
61
const UNIFORM_ACCESS_WAIT_TIME = 5 * 1000 ; // 5s
62
+ const BUCKET_METADATA_UPDATE_WAIT_TIME = 1000 ; // 1s buckets have a max rate of one metadata update per second.
62
63
63
64
// block all attempts to chat with the metadata server (kokoro runs on GCE)
64
65
nock ( 'http://metadata.google.internal' )
@@ -2554,6 +2555,9 @@ describe('storage', () => {
2554
2555
} ) ;
2555
2556
2556
2557
beforeEach ( async ( ) => {
2558
+ await new Promise ( res =>
2559
+ setTimeout ( res , BUCKET_METADATA_UPDATE_WAIT_TIME )
2560
+ ) ;
2557
2561
await bucket . setMetadata ( {
2558
2562
encryption : {
2559
2563
defaultKmsKeyName : kmsKeyName ,
@@ -2562,6 +2566,9 @@ describe('storage', () => {
2562
2566
} ) ;
2563
2567
2564
2568
afterEach ( async ( ) => {
2569
+ await new Promise ( res =>
2570
+ setTimeout ( res , BUCKET_METADATA_UPDATE_WAIT_TIME )
2571
+ ) ;
2565
2572
await bucket . setMetadata ( {
2566
2573
encryption : null ,
2567
2574
} ) ;
@@ -2583,6 +2590,9 @@ describe('storage', () => {
2583
2590
const newKmsKeyName = generateKmsKeyName ( cryptoKeyId ) ;
2584
2591
2585
2592
await createCryptoKeyAsync ( cryptoKeyId ) ;
2593
+ await new Promise ( res =>
2594
+ setTimeout ( res , BUCKET_METADATA_UPDATE_WAIT_TIME )
2595
+ ) ;
2586
2596
await bucket . setMetadata ( {
2587
2597
encryption : {
2588
2598
defaultKmsKeyName : newKmsKeyName ,
0 commit comments