Skip to content

Commit ba2aeed

Browse files
committed
[to be removed] debug logs on mpu
1 parent 822969c commit ba2aeed

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

tests/multipleBackend/multipartUpload.js

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ const fileLocation = 'scality-internal-file';
3737
const awsLocation = 'awsbackend';
3838
const awsLocationMismatch = 'awsbackendmismatch';
3939
const awsConfig = getRealAwsConfig(awsLocation);
40-
console.log('[INIT] AWS Config for awsbackend:', JSON.stringify(awsConfig, null, 2));
41-
console.log('[INIT] Location constraints awsbackend:', JSON.stringify(config.locationConstraints[awsLocation], null, 2));
42-
console.log('[INIT] Location constraints awsbackendmismatch:', JSON.stringify(config.locationConstraints[awsLocationMismatch], null, 2));
4340
const s3 = new S3Client(awsConfig);
4441
const log = new DummyRequestLogger();
4542

@@ -265,26 +262,20 @@ function assertObjOnBackend(expectedBackend, objectKey, cb) {
265262
}
266263

267264
function putParts(uploadId, key, cb) {
268-
console.log(`[DEBUG] putParts called - uploadId: ${uploadId}, key: ${key}`);
269265
const putPartParam1 = getPartParams(key, uploadId, 1);
270266
const partRequest = new DummyRequest(putPartParam1, bigBody);
271-
console.log(`[DEBUG] Putting part 1`);
272267
objectPutPart(authInfo, partRequest, undefined, log, err => {
273-
console.log(`[DEBUG] Part 1 put callback - err:`, err);
274268
assert.equal(err, null, `Error putting part: ${err}`);
275269
const putPartParam2 = getPartParams(key, uploadId, 2);
276270
const partRequest2 = new DummyRequest(putPartParam2, smallBody);
277-
console.log(`[DEBUG] Putting part 2`);
278271
objectPutPart(authInfo, partRequest2, undefined, log, err => {
279-
console.log(`[DEBUG] Part 2 put callback - err:`, err);
280272
assert.equal(err, null, `Error putting part: ${err}`);
281273
cb();
282274
});
283275
});
284276
}
285277

286278
function mpuSetup(location, key, cb) {
287-
console.log(`[DEBUG] mpuSetup called with location: ${location}, key: ${key}`);
288279
const initiateRequest = {
289280
bucketName,
290281
namespace,
@@ -295,15 +286,11 @@ function mpuSetup(location, key, cb) {
295286
parsedHost: 'localhost',
296287
actionImplicitDenies: false,
297288
};
298-
console.log(`[DEBUG] Calling initiateMultipartUpload for ${location}`);
299289
initiateMultipartUpload(authInfo, initiateRequest, log,
300290
(err, result) => {
301-
console.log(`[DEBUG] initiateMultipartUpload callback - err:`, err, 'result:', result ? 'present' : 'null');
302291
assert.strictEqual(err, null, 'Error initiating MPU');
303292
assertMpuInitResults(result, key, uploadId => {
304-
console.log(`[DEBUG] assertMpuInitResults callback - uploadId: ${uploadId}`);
305293
putParts(uploadId, key, () => {
306-
console.log(`[DEBUG] putParts completed`);
307294
cb(uploadId);
308295
});
309296
});
@@ -391,11 +378,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
391378

392379
it('should initiate a multipart upload on AWS location with ' +
393380
'bucketMatch equals false', done => {
394-
console.log('[TEST START] Initiate MPU on AWS with bucketMatch=false');
395381
const objectKey = `key-${Date.now()}`;
396-
console.log('[TEST] objectKey:', objectKey);
397-
console.log('[TEST] awsLocationMismatch:', awsLocationMismatch);
398-
console.log('[TEST] awsMismatchBucket:', awsMismatchBucket);
399382
const initiateRequest = {
400383
bucketName,
401384
namespace,
@@ -408,16 +391,10 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
408391
actionImplicitDenies: false,
409392
};
410393

411-
console.log('[TEST] Calling initiateMultipartUpload');
412394
initiateMultipartUpload(authInfo, initiateRequest, log,
413395
(err, result) => {
414-
console.log('[TEST] initiateMultipartUpload returned - err:', err, 'result:', result ? 'present' : 'null');
415-
if (err) {
416-
console.error('[TEST] Error details:', JSON.stringify(err, null, 2));
417-
}
418396
assert.strictEqual(err, null, 'Error initiating MPU');
419397
assertMpuInitResults(result, objectKey, uploadId => {
420-
console.log('[TEST] About to call abortMPU with uploadId:', uploadId);
421398
abortMPU(uploadId, getAwsParamsBucketNotMatch(objectKey), done);
422399
});
423400
});
@@ -450,9 +427,17 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
450427

451428
it('should list the parts of a multipart upload on real AWS', done => {
452429
const objectKey = `key-${Date.now()}`;
430+
console.log('[LIST TEST AWS] Starting listParts test');
453431
mpuSetup(awsLocation, objectKey, uploadId => {
432+
console.log('[LIST TEST AWS] MPU setup completed, uploadId:', uploadId);
454433
const listParams = getListParams(objectKey, uploadId);
434+
console.log('[LIST TEST AWS] listParams:', listParams);
435+
console.log('[LIST TEST AWS] Calling listParts...');
455436
listParts(authInfo, listParams, log, (err, result) => {
437+
console.log('[LIST TEST AWS] listParts returned - err:', err, 'result:', result ? 'present' : 'null');
438+
if (err) {
439+
console.error('[LIST TEST AWS] Error details:', err);
440+
}
456441
assert.equal(err, null, `Error listing parts on AWS: ${err}`);
457442
assertListResults(result, null, uploadId, objectKey);
458443
abortMPU(uploadId, getAwsParams(objectKey), done);
@@ -463,9 +448,17 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
463448
it('should list the parts of a multipart upload on real AWS location ' +
464449
'with bucketMatch set to false', done => {
465450
const objectKey = `key-${Date.now()}`;
451+
console.log('[LIST TEST] Starting listParts test with bucketMatch=false');
466452
mpuSetup(awsLocationMismatch, objectKey, uploadId => {
453+
console.log('[LIST TEST] MPU setup completed, uploadId:', uploadId);
467454
const listParams = getListParams(objectKey, uploadId);
455+
console.log('[LIST TEST] listParams:', listParams);
456+
console.log('[LIST TEST] Calling listParts...');
468457
listParts(authInfo, listParams, log, (err, result) => {
458+
console.log('[LIST TEST] listParts returned - err:', err, 'result:', result ? 'present' : 'null');
459+
if (err) {
460+
console.error('[LIST TEST] Error details:', err);
461+
}
469462
assert.equal(err, null, `Error listing parts on AWS: ${err}`);
470463
assertListResults(result, null, uploadId, objectKey);
471464
abortMPU(uploadId, getAwsParamsBucketNotMatch(objectKey), done);
@@ -495,6 +488,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
495488
const listParams = getListParams(objectKey, uploadId);
496489
listParams.query['part-number-marker'] = '1';
497490
listParts(authInfo, listParams, log, (err, result) => {
491+
console.log('[PART NUMBER MARKER TEST] listParts returned, err:', err);
498492
assert.equal(err, null);
499493
assertListResults(result, 'partNumMarker', uploadId, objectKey);
500494
abortMPU(uploadId, getAwsParams(objectKey), done);
@@ -508,6 +502,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
508502
abortMPU(uploadId, getAwsParams(objectKey), () => {
509503
const listParams = getListParams(objectKey, uploadId);
510504
listParts(authInfo, listParams, log, err => {
505+
console.log('[LIST DELETED MPU TEST] listParts returned, err:', err);
511506
let wantedDesc = 'Error returned from AWS: ' +
512507
'The specified upload does not exist. The upload ID ' +
513508
'may be invalid, or the upload may have been aborted' +

0 commit comments

Comments
 (0)