Skip to content

Commit

Permalink
Fix space before and after brackets
Browse files Browse the repository at this point in the history
Issue: CLDSRV-570
  • Loading branch information
KillianG committed Nov 15, 2024
1 parent 2d29ad3 commit 558e17b
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api/apiUtils/object/abortMultipartUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log,
uploadId,
versionId: objectMD.versionId
});
return metadata.deleteObjectMD(bucketName, objectKey, {versionId: objectMD.versionId}, log, err => {
return metadata.deleteObjectMD(bucketName, objectKey, { versionId: objectMD.versionId }, log, err => {
if (err) {
log.error('error deleting object metadata', { error: err });
}
Expand Down
106 changes: 106 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
const AWS = require('aws-sdk');
const s3 = new AWS.S3({
accessKeyId: 'UWB6VWIZPHI19HG74PPD',
secretAccessKey: 'HOO7agVIZ+mUrXJznyo7eT/2G1tsZrIRQ3WeP8vv',
endpoint: 'http://s3.workloadplane.pra.scality.local',
s3ForcePathStyle: true,
signatureVersion: 'v4',
maxRetries: 0,
});
const bucket = 'mpuver';
const key = 'test-object';
const partSize = 5 * 1024 * 1024;
const numParts = 10;
let uploadID;
let completedParts

Check failure on line 15 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Missing semicolon
async function createAndUploadMPU() {
try {
const createMPUResponse = await s3.createMultipartUpload({ Bucket: bucket, Key: key }).promise();
const uploadId = createMPUResponse.UploadId;
uploadID = uploadId;
console.log('Multipart upload initiated:', uploadId);

Check failure on line 21 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Unexpected console statement
let parts = [];

Check warning on line 22 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

'parts' is never reassigned. Use 'const' instead
for (let i = 1; i <= numParts; i++) {
const partData = Buffer.alloc(partSize, `Part-${i}`);
const uploadPartResponse = await s3.uploadPart({

Check failure on line 25 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Unexpected `await` inside a loop
Bucket: bucket,
Key: key,
PartNumber: i,
UploadId: uploadId,
Body: partData
}).promise();
parts.push({ ETag: uploadPartResponse.ETag, PartNumber: i });
console.log(`Uploaded part ${i}`);

Check failure on line 33 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Unexpected console statement
}
completedParts = parts.slice(0, numParts - 1);
await s3.completeMultipartUpload({
Bucket: bucket,
Key: key,
UploadId: uploadId,
MultipartUpload: { Parts: completedParts }
}).promise();
console.log('Multipart upload completed with parts', completedParts);

Check failure on line 42 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Unexpected console statement
} catch (error) {
console.error('Error in multipart upload:', error);

Check failure on line 44 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Unexpected console statement
console.log("===============================================")

Check failure on line 45 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Unexpected console statement

Check warning on line 45 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Strings must use singlequote

Check failure on line 45 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Missing semicolon
try {
console.log("uploadID", uploadID)

Check failure on line 47 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Unexpected console statement

Check warning on line 47 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Strings must use singlequote

Check failure on line 47 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Missing semicolon
} catch (error) {
console.error('Error in aborting multipart upload:', error);
}
}
}

async function abortMPU(uploadID) {
try {
await s3.abortMultipartUpload({
Bucket: bucket,
Key: key,
UploadId: uploadID
}).promise();
console.log('Multipart upload aborted');
} catch (error) {
console.error('Error in aborting multipart upload:', error);
}
}

async function createBucket() {
try {
await s3.createBucket({ Bucket: bucket }).promise();
console.log('Bucket created:', bucket);
} catch (error) {
console.error('Error in creating bucket:', error);
}
}

async function getObject() {
try {
const object = await s3.headObject({ Bucket: bucket, Key: key }).promise();
console.log('Object retrieved:', object);
} catch (error) {
console.log('Error in getting object:', error);
}
}

async function completeMPU() {
try {
await s3.completeMultipartUpload({
Bucket: bucket,
Key: key,
UploadId: uploadID,
MultipartUpload: { Parts: completedParts }
}).promise();
console.log('Multipart upload completed with parts', completedParts);
} catch (error) {
console.error('Error in completing multipart upload:', error);
}
}

async function main() {
await createAndUploadMPU();
console.log(">>>>>>>>>>>>>>>>>>>")

Check warning on line 101 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Strings must use singlequote
await getObject();
console.log("<<<<<<<<<")

Check warning on line 103 in test.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Strings must use singlequote
}

main()

0 comments on commit 558e17b

Please sign in to comment.