Skip to content

Commit 288606a

Browse files
CLDSRV-717: Skip based on configured location
To unify with S3C
1 parent d0f3bcc commit 288606a

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

tests/functional/aws-node-sdk/lib/utility/test-utils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ if (config.backends.data === 'multiple') {
1111
describeSkipIfNotMultipleOrCeph = isCEPH ? describe.skip : describe.skip; // always skip
1212
}
1313

14+
function hasLocation(lc) {
15+
return config.locationConstraints[lc] !== undefined;
16+
}
17+
1418
module.exports = {
1519
isCEPH,
1620
itSkipCeph,
1721
describeSkipIfCeph,
1822
describeSkipIfNotMultiple,
1923
describeSkipIfNotMultipleOrCeph,
24+
hasLocation,
2025
};

tests/multipleBackend/routes/routeBackbeat.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const assert = require('assert');
2-
const AWS = require('aws-sdk');
32
const async = require('async');
43
const crypto = require('crypto');
54
const { v4: uuidv4 } = require('uuid');
@@ -8,23 +7,23 @@ const versionIdUtils = versioning.VersionID;
87

98
const { makeid } = require('../../unit/helpers');
109
const { 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');
1416
const {
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');
2224
const { getCredentials } = require('../../functional/aws-node-sdk/test/support/credentials');
2325
const { 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;
2827
const azureClient = getAzureClient();
2928
const containerName = getAzureContainerName(azureLocation);
3029

@@ -165,6 +164,10 @@ function updateStorageClass(data, storageClass) {
165164
function 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
170173
describeSkipIfNotMultipleOrCeph('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

Comments
 (0)