11const assert = require ( 'assert' ) ;
2- const AWS = require ( 'aws-sdk' ) ;
32const async = require ( 'async' ) ;
43const crypto = require ( 'crypto' ) ;
54const { v4 : uuidv4 } = require ( 'uuid' ) ;
@@ -8,23 +7,23 @@ const versionIdUtils = versioning.VersionID;
87
98const { makeid } = require ( '../../unit/helpers' ) ;
109const { makeRequest, makeBackbeatRequest } = require ( '../../functional/raw-node/utils/makeRequest' ) ;
11- const BucketUtility =
12- require ( '../../functional/aws-node-sdk/lib/utility/bucket-util' ) ;
13- const { describeSkipIfNotMultipleOrCeph, itSkipCeph } = require ( '../../functional/aws-node-sdk/lib/utility/test-utils' ) ;
10+ const BucketUtility = require ( '../../functional/aws-node-sdk/lib/utility/bucket-util' ) ;
11+ const {
12+ describeSkipIfNotMultipleOrCeph,
13+ itSkipCeph,
14+ hasLocation
15+ } = require ( '../../functional/aws-node-sdk/lib/utility/test-utils' ) ;
1416const {
1517 awsLocation,
18+ awsS3 : awsClient ,
19+ awsBucket,
1620 azureLocation,
1721 getAzureContainerName,
1822 getAzureClient,
1923} = require ( '../../functional/aws-node-sdk/test/multipleBackend/utils' ) ;
20- const { getRealAwsConfig } =
21- require ( '../../functional/aws-node-sdk/test/support/awsConfig' ) ;
2224const { getCredentials } = require ( '../../functional/aws-node-sdk/test/support/credentials' ) ;
2325const { config } = require ( '../../../lib/Config' ) ;
2426
25- const awsConfig = getRealAwsConfig ( awsLocation ) ;
26- const awsClient = new AWS . S3 ( awsConfig ) ;
27- const awsBucket = config . locationConstraints [ awsLocation ] . details . bucketName ;
2827const azureClient = getAzureClient ( ) ;
2928const containerName = getAzureContainerName ( azureLocation ) ;
3029
@@ -165,6 +164,10 @@ function updateStorageClass(data, storageClass) {
165164function generateUniqueBucketName ( prefix , suffix = uuidv4 ( ) ) {
166165 return `${ prefix } -${ suffix . substring ( 0 , 8 ) } ` . substring ( 0 , 63 ) ;
167166}
167+ const describeIfLocationAws = hasLocation ( awsLocation ) ? describe : describe . skip ;
168+ const itIfLocationAwsSkipCeph = hasLocation ( awsLocation ) ? itSkipCeph : it . skip ;
169+ const itIfLocationAws = hasLocation ( awsLocation ) ? it : it . skip ;
170+ const itIfLocationAzure = hasLocation ( azureLocation ) ? it : it . skip ;
168171
169172// FIXME: does not pass for Ceph, see CLDSRV-443
170173describeSkipIfNotMultipleOrCeph ( 'backbeat DELETE routes' , ( ) => {
@@ -1657,7 +1660,7 @@ describe('backbeat routes', () => {
16571660 } ) ;
16581661 } ) ;
16591662
1660- itSkipCeph ( 'should PUT tags for a non-versioned bucket' , function test ( done ) {
1663+ itIfLocationAwsSkipCeph ( 'should PUT tags for a non-versioned bucket (awslocation) ' , function test ( done ) {
16611664 this . timeout ( 10000 ) ;
16621665 const bucket = NONVERSIONED_BUCKET ;
16631666 const awsKey = uuidv4 ( ) ;
@@ -2364,7 +2367,8 @@ describe('backbeat routes', () => {
23642367 } ) ;
23652368 } ) ;
23662369 } ) ;
2367- describe ( 'backbeat multipart upload operations' , function test ( ) {
2370+
2371+ describeIfLocationAws ( 'backbeat multipart upload operations (external location)' , function test ( ) {
23682372 this . timeout ( 10000 ) ;
23692373
23702374 // The ceph image does not support putting tags during initiate MPU.
@@ -2575,12 +2579,13 @@ describe('backbeat routes', () => {
25752579 } , err => {
25762580 // should error out as location shall no longer exist
25772581 assert ( err ) ;
2582+ assert . strictEqual ( err . statusCode , 503 ) ;
25782583 done ( ) ;
25792584 } ) ,
25802585 ] , done ) ;
25812586 } ) ;
25822587
2583- itSkipCeph ( 'should batch delete a versioned AWS location' , done => {
2588+ itIfLocationAwsSkipCeph ( 'should batch delete a versioned AWS location' , done => {
25842589 let versionId ;
25852590 const awsKey = `${ TEST_BUCKET } /batch-delete-test-key-${ makeid ( 8 ) } ` ;
25862591
@@ -2677,7 +2682,7 @@ describe('backbeat routes', () => {
26772682 ] , done ) ;
26782683 } ) ;
26792684
2680- it ( 'should not put delete tags if the source is not Azure and ' +
2685+ itIfLocationAws ( 'should not put delete tags if the source is not Azure and ' +
26812686 'if-unmodified-since header is not provided' , done => {
26822687 const awsKey = uuidv4 ( ) ;
26832688 async . series ( [
@@ -2720,7 +2725,7 @@ describe('backbeat routes', () => {
27202725 ] , done ) ;
27212726 } ) ;
27222727
2723- itSkipCeph ( 'should not put tags if the source is not Azure and ' +
2728+ itIfLocationAwsSkipCeph ( 'should not put tags if the source is not Azure and ' +
27242729 'if-unmodified-since condition is not met' , done => {
27252730 const awsKey = uuidv4 ( ) ;
27262731 async . series ( [
@@ -2765,7 +2770,7 @@ describe('backbeat routes', () => {
27652770 ] , done ) ;
27662771 } ) ;
27672772
2768- itSkipCeph ( 'should put tags if the source is not Azure and ' +
2773+ itIfLocationAwsSkipCeph ( 'should put tags if the source is not Azure and ' +
27692774 'if-unmodified-since condition is met' , done => {
27702775 const awsKey = uuidv4 ( ) ;
27712776 let lastModified ;
@@ -2835,7 +2840,7 @@ describe('backbeat routes', () => {
28352840 ] , done ) ;
28362841 } ) ;
28372842
2838- it ( 'should not delete the object if the source is Azure and ' +
2843+ itIfLocationAzure ( 'should not delete the object if the source is Azure and ' +
28392844 'if-unmodified-since condition is not met' , done => {
28402845 const blob = uuidv4 ( ) ;
28412846 async . series ( [
@@ -2881,7 +2886,7 @@ describe('backbeat routes', () => {
28812886 ] , done ) ;
28822887 } ) ;
28832888
2884- it ( 'should delete the object if the source is Azure and ' +
2889+ itIfLocationAzure ( 'should delete the object if the source is Azure and ' +
28852890 'if-unmodified-since condition is met' , done => {
28862891 const blob = uuidv4 ( ) ;
28872892 let lastModified ;
0 commit comments