Skip to content

Commit af676b5

Browse files
committed
post review fixups
1 parent ca39250 commit af676b5

36 files changed

Lines changed: 1245 additions & 1598 deletions

tests/functional/aws-node-sdk/lib/utility/tagging.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ const taggingTests = [
55
it: 'should return tags if value is an empty string' },
66
{ tag: { key: 'w'.repeat(129), value: 'foo' },
77
error: 'InvalidTag',
8+
code: 400,
89
it: 'should return InvalidTag if key length is greater than 128' },
910
{ tag: { key: 'bar', value: 'f'.repeat(257) },
1011
error: 'InvalidTag',
12+
code: 400,
1113
it: 'should return InvalidTag if key length is greater than 256',
1214
},
1315
];

tests/functional/aws-node-sdk/lib/utility/versioning-util.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ function _deleteVersionList(versionList, bucket, callback) {
3131
function checkOneVersion(s3, bucket, versionId, callback) {
3232
return s3Client.send(new ListObjectVersionsCommand({ Bucket: bucket })).then(data => {
3333
assert.strictEqual(data.Versions.length, 1);
34-
3534
if (versionId) {
3635
assert.strictEqual(data.Versions[0].VersionId, versionId);
3736
}

tests/functional/aws-node-sdk/test/object/abortMPU.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function cleanupVersionedBucket(bucketUtil, bucketName) {
3939
const listMPUResponse = await bucketUtil.s3.send(new ListMultipartUploadsCommand({ Bucket: bucketName }));
4040
if (listMPUResponse.Uploads && listMPUResponse.Uploads.length > 0) {
4141
await Promise.all(listMPUResponse.Uploads.map(async upload => {
42-
await bucketUtil.s3.send(new AbortMultipartUploadCommand({
42+
bucketUtil.s3.send(new AbortMultipartUploadCommand({
4343
Bucket: bucketName,
4444
Key: upload.Key,
4545
UploadId: upload.UploadId,
@@ -501,7 +501,7 @@ describe('Abort MPU - Versioned Bucket Cleanup', function testSuite() {
501501
next => {
502502
s3.send(new ListObjectVersionsCommand({ Bucket: bucketName }))
503503
.then(data => {
504-
const objectVersions = data.Versions?.filter(v => v.Key === objectKey) || [];
504+
const objectVersions = (data.Versions || []).filter(v => v.Key === objectKey);
505505
assert.strictEqual(objectVersions.length, 0,
506506
`Expected 0 versions after abort, got ${objectVersions.length}`);
507507
next();
@@ -648,6 +648,7 @@ describe('Abort MPU - Orphan Cleanup', function testSuite() {
648648
assert.fail('Orphaned object should be deleted after abort');
649649
} catch (err) {
650650
assert(err);
651+
assert.strictEqual(err.name, 'NotFound');
651652
assert.strictEqual(err.$metadata.httpStatusCode, 404);
652653
}
653654
});
@@ -812,7 +813,7 @@ describe('Abort MPU - Race Conditions', function testSuite() {
812813

813814
// Verify no MPU metadata remains
814815
const listResult = await s3.send(new ListMultipartUploadsCommand({ Bucket: bucketName }));
815-
const remainingUploads = listResult.Uploads?.filter(upload => upload.UploadId === uploadId) || [];
816+
const remainingUploads = (listResult.Uploads || [] ).filter(upload => upload.UploadId === uploadId);
816817
assert.strictEqual(remainingUploads.length, 0, 'No MPU metadata should remain');
817818
});
818819

@@ -881,7 +882,7 @@ describe('Abort MPU - Race Conditions', function testSuite() {
881882

882883
// Verify no MPU metadata remains
883884
const listResult = await s3.send(new ListMultipartUploadsCommand({ Bucket: bucketName }));
884-
const remainingUploads = listResult.Uploads?.filter(upload => upload.UploadId === uploadId) || [];
885+
const remainingUploads = (listResult.Uploads || []).filter(upload => upload.UploadId === uploadId);
885886
assert.strictEqual(remainingUploads.length, 0,
886887
'No MPU metadata should remain after concurrent aborts');
887888
});

tests/functional/aws-node-sdk/test/object/bigMpu.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function uploadPart(n, uploadId, s3, next) {
5353
// could be poor system resources.
5454
describe('large mpu', function tester() {
5555
this.timeout(600000);
56-
let s3;
56+
let s3;
5757
before(done => {
5858
const config = getConfig('default', { signatureVersion: 'v4' });
5959
// disable node sdk retries and timeout to prevent InvalidPart
@@ -94,7 +94,6 @@ describe('large mpu', function tester() {
9494
itSkipIfAWS('should intiate, put parts and complete mpu ' +
9595
`with ${partCount} parts`, done => {
9696
process.stdout.write('***Running large MPU test***\n');
97-
const startTime = Date.now(); // Record start time for performance measurement
9897
let uploadId;
9998
return waterfall([
10099
next => {
@@ -126,7 +125,7 @@ describe('large mpu', function tester() {
126125
ETag: partETags[i],
127126
PartNumber: i + 1,
128127
});
129-
}
128+
}
130129
const params = {
131130
Bucket: bucket,
132131
Key: key,
@@ -137,8 +136,7 @@ describe('large mpu', function tester() {
137136
};
138137
return s3.send(new CompleteMultipartUploadCommand(params))
139138
.then(() => {
140-
const duration = Date.now() - startTime;
141-
process.stdout.write(`mpu completed successfully in ${duration}ms\n`);
139+
process.stdout.write(`mpu completed successfully\n`);
142140
next();
143141
})
144142
.catch(err => next(err));

tests/functional/aws-node-sdk/test/object/completeMPU.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('Complete MPU', () => {
4141
UploadId: uploadId
4242
}))
4343
.then(data => {
44-
versionId = data.VersionId; // Assign to the outer scope variable
44+
versionId = data.VersionId;
4545
if (expectedVid) {
4646
assert.notEqual(versionId, undefined);
4747
} else {
@@ -54,12 +54,11 @@ describe('Complete MPU', () => {
5454
})
5555
.then(data => {
5656
if (versionId) {
57-
// Check version ID when we expect one
5857
assert.strictEqual(data.VersionId, versionId);
5958
}
6059
cb();
6160
})
62-
.catch(err => cb(err));
61+
.catch(cb);
6362
}
6463

6564
function _initiateMpuAndPutOnePart() {
@@ -156,7 +155,6 @@ describe('Complete MPU', () => {
156155
.then(result => {
157156
uploadId = result.uploadId;
158157
eTag = result.eTag;
159-
return result;
160158
})
161159
);
162160

@@ -246,7 +244,8 @@ describe('Complete MPU', () => {
246244
});
247245
});
248246
});
249-
describe('with re-upload of part during CompleteMPU execution', () => {
247+
248+
describe('with re-upload of part during CompleteMPU execution', () => {
250249
let uploadId;
251250
let eTag;
252251

0 commit comments

Comments
 (0)