@@ -37,12 +37,12 @@ const backbeatAuthCredentials = {
3737 accessKey : accessKeyId ,
3838 secretKey : secretAccessKey ,
3939} ;
40- const TEST_BUCKET = 'backbeatbucket' ;
41- const TEST_ENCRYPTED_BUCKET = 'backbeatbucket-encrypted' ;
40+ const TEST_BUCKET_PREFIX = 'backbeatbucket' ;
41+ const TEST_ENCRYPTED_BUCKET_PREFIX = 'backbeatbucket-encrypted' ;
4242const TEST_KEY = 'fookey' ;
43- const NONVERSIONED_BUCKET = 'backbeatbucket-non-versioned' ;
44- const VERSION_SUSPENDED_BUCKET = 'backbeatbucket-version-suspended' ;
45- const BUCKET_FOR_NULL_VERSION = 'backbeatbucket-null-version' ;
43+ const NONVERSIONED_BUCKET_PREFIX = 'backbeatbucket-non-versioned' ;
44+ const VERSION_SUSPENDED_BUCKET_PREFIX = 'backbeatbucket-version-suspended' ;
45+ const BUCKET_FOR_NULL_VERSION_PREFIX = 'backbeatbucket-null-version' ;
4646
4747const testArn = 'aws::iam:123456789012:user/bart' ;
4848const testKey = 'testkey' ;
@@ -162,6 +162,10 @@ function updateStorageClass(data, storageClass) {
162162 return { result } ;
163163}
164164
165+ function generateUniqueBucketName ( prefix , suffix = uuidv4 ( ) ) {
166+ return `${ prefix } -${ suffix . substring ( 0 , 8 ) } ` . substring ( 0 , 63 ) ;
167+ }
168+
165169// FIXME: does not pass for Ceph, see CLDSRV-443
166170describeSkipIfNotMultipleOrCeph ( 'backbeat DELETE routes' , ( ) => {
167171 it ( 'abort MPU' , done => {
@@ -226,6 +230,12 @@ function getMetadataToPut(putDataResponse) {
226230describe ( 'backbeat routes' , ( ) => {
227231 let bucketUtil ;
228232 let s3 ;
233+ const suffix = uuidv4 ( ) ;
234+ // These buckets are created once before tests
235+ const TEST_BUCKET = generateUniqueBucketName ( TEST_BUCKET_PREFIX , suffix ) ;
236+ const TEST_ENCRYPTED_BUCKET = generateUniqueBucketName ( TEST_ENCRYPTED_BUCKET_PREFIX , suffix ) ;
237+ const NONVERSIONED_BUCKET = generateUniqueBucketName ( NONVERSIONED_BUCKET_PREFIX , suffix ) ;
238+ const VERSION_SUSPENDED_BUCKET = generateUniqueBucketName ( VERSION_SUSPENDED_BUCKET_PREFIX , suffix ) ;
229239
230240 before ( done => {
231241 bucketUtil = new BucketUtility (
@@ -288,7 +298,7 @@ describe('backbeat routes', () => {
288298 ) ;
289299
290300 describe ( 'null version' , ( ) => {
291- const bucket = BUCKET_FOR_NULL_VERSION ;
301+ let bucket ;
292302 const keyName = 'key0' ;
293303 const storageClass = 'foo' ;
294304
@@ -306,14 +316,15 @@ describe('backbeat routes', () => {
306316 assert . strictEqual ( StorageClass , 'STANDARD' ) ;
307317 }
308318
309- beforeEach ( ( ) =>
310- bucketUtil . emptyIfExists ( BUCKET_FOR_NULL_VERSION )
311- . then ( ( ) => s3 . createBucket ( { Bucket : BUCKET_FOR_NULL_VERSION } ) . promise ( ) )
312- ) ;
319+ beforeEach ( ( ) => {
320+ bucket = generateUniqueBucketName ( BUCKET_FOR_NULL_VERSION_PREFIX ) ;
321+ return bucketUtil . emptyIfExists ( bucket )
322+ . then ( ( ) => s3 . createBucket ( { Bucket : bucket } ) . promise ( ) ) ;
323+ } ) ;
313324
314325 afterEach ( ( ) =>
315- bucketUtil . empty ( BUCKET_FOR_NULL_VERSION )
316- . then ( ( ) => s3 . deleteBucket ( { Bucket : BUCKET_FOR_NULL_VERSION } ) . promise ( ) )
326+ bucketUtil . empty ( bucket )
327+ . then ( ( ) => s3 . deleteBucket ( { Bucket : bucket } ) . promise ( ) )
317328 ) ;
318329
319330 it ( 'should update metadata of a current null version' , done => {
0 commit comments