Skip to content

Commit 0888839

Browse files
Merge remote-tracking branch 'origin/bugfix/CLDSRV-394' into w/9.1/bugfix/CLDSRV-394
2 parents edcf34a + 3c9e197 commit 0888839

File tree

5 files changed

+64
-72
lines changed

5 files changed

+64
-72
lines changed

.github/workflows/tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ jobs:
230230
S3_LOCATION_FILE: /usr/src/app/tests/locationConfig/locationConfigTests.json
231231
S3DATA: multiple
232232
S3METADATA: mongodb
233+
ENABLE_NULL_VERSION_COMPAT_MODE: true # needed with mongodb backend
233234
JOB_NAME: ${{ github.job }}
234235
steps:
235236
- name: Checkout
@@ -557,6 +558,7 @@ jobs:
557558
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
558559
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
559560
JOB_NAME: ${{ github.job }}
561+
ENABLE_NULL_VERSION_COMPAT_MODE: true # needed with mongodb backend
560562
steps:
561563
- name: Checkout
562564
uses: actions/checkout@v4

lib/routes/routeBackbeat.js

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ function handleTaggingOperation(request, response, type, dataStoreVersionId,
311311
const dataRetrievalInfo = {
312312
versionId: dataStoreVersionId,
313313
};
314-
return _respond(response, dataRetrievalInfo, log, callback);
314+
return response ? _respond(response, dataRetrievalInfo, log, callback) : callback();
315315
});
316316
}
317317

@@ -534,15 +534,9 @@ function putMetadata(request, response, bucketInfo, objMd, log, callback) {
534534
});
535535
}
536536

537-
let versionId;
538-
let versioning;
537+
let versionId = decodeVersionId(request.query);
538+
let versioning = bucketInfo.isVersioningEnabled();
539539
let isNull = false;
540-
const decodedVidResult = decodeVersionId(request.query);
541-
542-
if (decodedVidResult || omVal.replicationInfo.isNFS) {
543-
versionId = decodedVidResult;
544-
versioning = bucketInfo.isVersioningEnabled();
545-
}
546540

547541
if (versionId === 'null') {
548542
isNull = true;
@@ -1141,17 +1135,16 @@ function _azureConditionalDelete(request, response, log, cb) {
11411135
}
11421136

11431137
function _putTagging(request, response, log, cb) {
1144-
return handleTaggingOperation(
1145-
request, response, 'Put', undefined, log, err => {
1146-
if (err) {
1147-
log.error('put tagging failed', {
1148-
method: '_putTagging',
1149-
error: err,
1150-
});
1151-
return cb(err);
1152-
}
1153-
return _respond(response, null, log, cb);
1154-
});
1138+
return handleTaggingOperation(request, null, 'Put', undefined, log, err => {
1139+
if (err) {
1140+
log.error('put tagging failed', {
1141+
method: '_putTagging',
1142+
error: err,
1143+
});
1144+
return cb(err);
1145+
}
1146+
return _respond(response, null, log, cb);
1147+
});
11551148
}
11561149

11571150
function _conditionalTagging(request, response, locations, log, cb) {

tests/functional/aws-node-sdk/test/multipleBackend/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let gcpBucket;
4141
let gcpBucketMPU;
4242

4343
const isCEPH = process.env.CI_CEPH !== undefined;
44-
const itSkipCeph = isCEPH ? it.skip : it.skip;
44+
const itSkipCeph = isCEPH ? it.skip : it;
4545
const describeSkipIfCeph = isCEPH ? describe.skip : describe.skip; // always skip
4646

4747
if (config.backends.data === 'multiple') {

tests/multipleBackend/routes/routeBackbeat.js

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const azureClient = getAzureClient();
3030
const containerName = getAzureContainerName(azureLocation);
3131

3232
const ipAddress = process.env.IP ? process.env.IP : '127.0.0.1';
33+
const isNullVersionCompatMode = process.env.ENABLE_NULL_VERSION_COMPAT_MODE === 'true';
3334

3435
const { accessKeyId, secretAccessKey } = getCredentials();
3536

@@ -379,6 +380,9 @@ describe('backbeat routes', () => {
379380
const objMDAfter = JSON.parse(getMetadataAfterRes.body).Body;
380381
const expectedMd = JSON.parse(objMD);
381382
expectedMd.isNull = true; // TODO remove the line once CLDSRV-509 is fixed
383+
if (!isNullVersionCompatMode) {
384+
expectedMd.isNull2 = true; // TODO remove the line once CLDSRV-509 is fixed
385+
}
382386
assert.deepStrictEqual(JSON.parse(objMDAfter), expectedMd);
383387

384388
const listObjectVersionsRes = results.listObjectVersions;
@@ -1447,8 +1451,7 @@ describe('backbeat routes', () => {
14471451
});
14481452
});
14491453

1450-
// TODO: CLDSRV-394 unskip routeBackbeat tests
1451-
describe.skip('backbeat PUT routes', () => {
1454+
describe('backbeat PUT routes', () => {
14521455
describe('PUT data + metadata should create a new complete object',
14531456
() => {
14541457
[{
@@ -1644,11 +1647,9 @@ describe('backbeat routes', () => {
16441647
});
16451648
});
16461649

1647-
it('should PUT tags for a non-versioned bucket', function test(done) {
1650+
itSkipCeph('should PUT tags for a non-versioned bucket', function test(done) {
16481651
this.timeout(10000);
16491652
const bucket = NONVERSIONED_BUCKET;
1650-
const awsBucket =
1651-
config.locationConstraints[awsLocation].details.bucketName;
16521653
const awsKey = uuidv4();
16531654
async.waterfall([
16541655
next =>
@@ -2153,7 +2154,7 @@ describe('backbeat routes', () => {
21532154
});
21542155
});
21552156
});
2156-
describe.skip('backbeat authorization checks', () => {
2157+
describe('backbeat authorization checks', () => {
21572158
[{ method: 'PUT', resourceType: 'metadata' },
21582159
{ method: 'PUT', resourceType: 'data' }].forEach(test => {
21592160
const queryObj = test.resourceType === 'data' ? { v2: '' } : {};
@@ -2271,7 +2272,7 @@ describe('backbeat routes', () => {
22712272
});
22722273
});
22732274

2274-
describe.skip('GET Metadata route', () => {
2275+
describe('GET Metadata route', () => {
22752276
beforeEach(done => makeBackbeatRequest({
22762277
method: 'PUT', bucket: TEST_BUCKET,
22772278
objectKey: TEST_KEY,
@@ -2329,14 +2330,12 @@ describe('backbeat routes', () => {
23292330
});
23302331
});
23312332
});
2332-
describe.skip('backbeat multipart upload operations', function test() {
2333+
describe('backbeat multipart upload operations', function test() {
23332334
this.timeout(10000);
23342335

23352336
// The ceph image does not support putting tags during initiate MPU.
23362337
itSkipCeph('should put tags if the source is AWS and tags are ' +
2337-
'provided when initiating the multipart upload', done => {
2338-
const awsBucket =
2339-
config.locationConstraints[awsLocation].details.bucketName;
2338+
'provided when initiating the multipart upload', done => {
23402339
const awsKey = uuidv4();
23412340
const multipleBackendPath =
23422341
`/_/backbeat/multiplebackenddata/${awsBucket}/${awsKey}`;
@@ -2478,19 +2477,16 @@ describe('backbeat routes', () => {
24782477
jsonResponse: true,
24792478
}, next),
24802479
next =>
2481-
azureClient.getBlobProperties(
2482-
containerName, blob, (err, result) => {
2483-
if (err) {
2484-
return next(err);
2485-
}
2480+
azureClient.getContainerClient(containerName).getBlobClient(blob).getProperties()
2481+
.then(result => {
24862482
const tags = JSON.parse(result.metadata.tags);
24872483
assert.deepStrictEqual(tags, { key1: 'value1' });
24882484
return next();
2489-
}),
2485+
}, next),
24902486
], done);
24912487
});
24922488
});
2493-
describe.skip('Batch Delete Route', function test() {
2489+
describe('Batch Delete Route', function test() {
24942490
this.timeout(30000);
24952491
it('should batch delete a local location', done => {
24962492
let versionId;
@@ -2549,7 +2545,8 @@ describe('backbeat routes', () => {
25492545
}),
25502546
], done);
25512547
});
2552-
it('should batch delete a versioned AWS location', done => {
2548+
2549+
itSkipCeph('should batch delete a versioned AWS location', done => {
25532550
let versionId;
25542551
const awsKey = `${TEST_BUCKET}/batch-delete-test-key-${makeid(8)}`;
25552552

@@ -2689,7 +2686,7 @@ describe('backbeat routes', () => {
26892686
], done);
26902687
});
26912688

2692-
it('should not put tags if the source is not Azure and ' +
2689+
itSkipCeph('should not put tags if the source is not Azure and ' +
26932690
'if-unmodified-since condition is not met', done => {
26942691
const awsKey = uuidv4();
26952692
async.series([
@@ -2734,7 +2731,7 @@ describe('backbeat routes', () => {
27342731
], done);
27352732
});
27362733

2737-
it('should put tags if the source is not Azure and ' +
2734+
itSkipCeph('should put tags if the source is not Azure and ' +
27382735
'if-unmodified-since condition is met', done => {
27392736
const awsKey = uuidv4();
27402737
let lastModified;
@@ -2809,8 +2806,8 @@ describe('backbeat routes', () => {
28092806
const blob = uuidv4();
28102807
async.series([
28112808
next =>
2812-
azureClient.createBlockBlobFromText(
2813-
containerName, blob, 'a', null, next),
2809+
azureClient.getContainerClient(containerName).uploadBlockBlob(blob, 'a', 1)
2810+
.then(() => next(), next),
28142811
next =>
28152812
makeRequest({
28162813
authCredentials: backbeatAuthCredentials,
@@ -2842,14 +2839,11 @@ describe('backbeat routes', () => {
28422839
return next(err);
28432840
}),
28442841
next =>
2845-
azureClient.getBlobProperties(
2846-
containerName, blob, (err, result) => {
2847-
if (err) {
2848-
return next(err);
2849-
}
2842+
azureClient.getContainerClient(containerName).getBlobClient(blob).getProperties()
2843+
.then(result => {
28502844
assert(result);
28512845
return next();
2852-
}),
2846+
}, next),
28532847
], done);
28542848
});
28552849

@@ -2859,17 +2853,14 @@ describe('backbeat routes', () => {
28592853
let lastModified;
28602854
async.series([
28612855
next =>
2862-
azureClient.createBlockBlobFromText(
2863-
containerName, blob, 'a', null, next),
2856+
azureClient.getContainerClient(containerName).uploadBlockBlob(blob, 'a', 1)
2857+
.then(() => next(), next),
28642858
next =>
2865-
azureClient.getBlobProperties(
2866-
containerName, blob, (err, result) => {
2867-
if (err) {
2868-
return next(err);
2869-
}
2859+
azureClient.getContainerClient(containerName).getBlobClient(blob).getProperties()
2860+
.then(result => {
28702861
lastModified = result.lastModified;
28712862
return next();
2872-
}),
2863+
}, next),
28732864
next =>
28742865
makeRequest({
28752866
authCredentials: backbeatAuthCredentials,
@@ -2895,10 +2886,11 @@ describe('backbeat routes', () => {
28952886
jsonResponse: true,
28962887
}, next),
28972888
next =>
2898-
azureClient.getBlobProperties(containerName, blob, err => {
2899-
assert(err.statusCode === 404);
2900-
return next();
2901-
}),
2889+
azureClient.getContainerClient(containerName).getBlobClient(blob).getProperties()
2890+
.then(() => assert.fail('Expected error'), err => {
2891+
assert.strictEqual(err.statusCode, 404);
2892+
return next();
2893+
}),
29022894
], done);
29032895
});
29042896
});

tests/sur/routeVeeam.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,14 @@ function makeVeeamRequest(params, callback) {
152152
.then(() => done())
153153
.catch(err => {
154154
process.stdout.write(`Error creating bucket: ${err}\n`);
155-
throw err;
155+
done(err);
156156
});
157157
});
158158
after(done => {
159159
bucketUtil.empty(TEST_BUCKET)
160160
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
161-
.then(() => done());
161+
.then(() => done())
162+
.catch(done);
162163
});
163164

164165
[
@@ -239,13 +240,14 @@ function makeVeeamRequest(params, callback) {
239240
.then(() => done())
240241
.catch(err => {
241242
process.stdout.write(`Error creating bucket: ${err}\n`);
242-
throw err;
243+
done(err);
243244
});
244245
});
245246
afterEach(done => {
246247
bucketUtil.empty(TEST_BUCKET)
247248
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
248-
.then(() => done());
249+
.then(() => done())
250+
.catch(done);
249251
});
250252

251253
[
@@ -374,13 +376,14 @@ function makeVeeamRequest(params, callback) {
374376
.then(() => done())
375377
.catch(err => {
376378
process.stdout.write(`Error creating bucket: ${err}\n`);
377-
throw err;
379+
done(err);
378380
});
379381
});
380382
afterEach(done => {
381383
bucketUtil.empty(TEST_BUCKET)
382384
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
383-
.then(() => done());
385+
.then(() => done())
386+
.catch(done);
384387
});
385388

386389
[
@@ -485,13 +488,14 @@ function makeVeeamRequest(params, callback) {
485488
.then(() => done())
486489
.catch(err => {
487490
process.stdout.write(`Error creating bucket: ${err}\n`);
488-
throw err;
491+
done(err);
489492
});
490493
});
491494
afterEach(done => {
492495
bucketUtil.empty(TEST_BUCKET)
493496
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
494-
.then(() => done());
497+
.then(() => done())
498+
.catch(done);
495499
});
496500

497501
[
@@ -571,12 +575,13 @@ describe.skip('veeam LIST routes:', () => {
571575
.then(() => done())
572576
.catch(err => {
573577
process.stdout.write(`Error creating bucket: ${err}\n`);
574-
throw err;
578+
done(err);
575579
});
576580
});
577581
afterEach(done => {
578582
bucketUtil.empty(TEST_BUCKET)
579583
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
580-
.then(() => done());
584+
.then(() => done())
585+
.catch(done);
581586
});
582587
});

0 commit comments

Comments
 (0)