Skip to content

Commit 39c4c84

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

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

tests/multipleBackend/multipartUpload.js

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ 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);
44-
const log = new DummyRequestLogger();
41+
// Use real logger instead of DummyRequestLogger to see Arsenal's error logs
42+
const log = logger.newRequestLogger();
4543

4644
const fakeUploadId = 'fakeuploadid';
4745
const canonicalID = 'accessKey1';
@@ -265,26 +263,20 @@ function assertObjOnBackend(expectedBackend, objectKey, cb) {
265263
}
266264

267265
function putParts(uploadId, key, cb) {
268-
console.log(`[DEBUG] putParts called - uploadId: ${uploadId}, key: ${key}`);
269266
const putPartParam1 = getPartParams(key, uploadId, 1);
270267
const partRequest = new DummyRequest(putPartParam1, bigBody);
271-
console.log(`[DEBUG] Putting part 1`);
272268
objectPutPart(authInfo, partRequest, undefined, log, err => {
273-
console.log(`[DEBUG] Part 1 put callback - err:`, err);
274269
assert.equal(err, null, `Error putting part: ${err}`);
275270
const putPartParam2 = getPartParams(key, uploadId, 2);
276271
const partRequest2 = new DummyRequest(putPartParam2, smallBody);
277-
console.log(`[DEBUG] Putting part 2`);
278272
objectPutPart(authInfo, partRequest2, undefined, log, err => {
279-
console.log(`[DEBUG] Part 2 put callback - err:`, err);
280273
assert.equal(err, null, `Error putting part: ${err}`);
281274
cb();
282275
});
283276
});
284277
}
285278

286279
function mpuSetup(location, key, cb) {
287-
console.log(`[DEBUG] mpuSetup called with location: ${location}, key: ${key}`);
288280
const initiateRequest = {
289281
bucketName,
290282
namespace,
@@ -295,15 +287,11 @@ function mpuSetup(location, key, cb) {
295287
parsedHost: 'localhost',
296288
actionImplicitDenies: false,
297289
};
298-
console.log(`[DEBUG] Calling initiateMultipartUpload for ${location}`);
299290
initiateMultipartUpload(authInfo, initiateRequest, log,
300291
(err, result) => {
301-
console.log(`[DEBUG] initiateMultipartUpload callback - err:`, err, 'result:', result ? 'present' : 'null');
302292
assert.strictEqual(err, null, 'Error initiating MPU');
303293
assertMpuInitResults(result, key, uploadId => {
304-
console.log(`[DEBUG] assertMpuInitResults callback - uploadId: ${uploadId}`);
305294
putParts(uploadId, key, () => {
306-
console.log(`[DEBUG] putParts completed`);
307295
cb(uploadId);
308296
});
309297
});
@@ -391,11 +379,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
391379

392380
it('should initiate a multipart upload on AWS location with ' +
393381
'bucketMatch equals false', done => {
394-
console.log('[TEST START] Initiate MPU on AWS with bucketMatch=false');
395382
const objectKey = `key-${Date.now()}`;
396-
console.log('[TEST] objectKey:', objectKey);
397-
console.log('[TEST] awsLocationMismatch:', awsLocationMismatch);
398-
console.log('[TEST] awsMismatchBucket:', awsMismatchBucket);
399383
const initiateRequest = {
400384
bucketName,
401385
namespace,
@@ -408,16 +392,10 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
408392
actionImplicitDenies: false,
409393
};
410394

411-
console.log('[TEST] Calling initiateMultipartUpload');
412395
initiateMultipartUpload(authInfo, initiateRequest, log,
413396
(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-
}
418397
assert.strictEqual(err, null, 'Error initiating MPU');
419398
assertMpuInitResults(result, objectKey, uploadId => {
420-
console.log('[TEST] About to call abortMPU with uploadId:', uploadId);
421399
abortMPU(uploadId, getAwsParamsBucketNotMatch(objectKey), done);
422400
});
423401
});
@@ -450,9 +428,17 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
450428

451429
it('should list the parts of a multipart upload on real AWS', done => {
452430
const objectKey = `key-${Date.now()}`;
431+
console.log('[LIST TEST AWS] Starting listParts test');
453432
mpuSetup(awsLocation, objectKey, uploadId => {
433+
console.log('[LIST TEST AWS] MPU setup completed, uploadId:', uploadId);
454434
const listParams = getListParams(objectKey, uploadId);
435+
console.log('[LIST TEST AWS] listParams:', listParams);
436+
console.log('[LIST TEST AWS] Calling listParts...');
455437
listParts(authInfo, listParams, log, (err, result) => {
438+
console.log('[LIST TEST AWS] listParts returned - err:', err, 'result:', result ? 'present' : 'null');
439+
if (err) {
440+
console.error('[LIST TEST AWS] Error details:', err);
441+
}
456442
assert.equal(err, null, `Error listing parts on AWS: ${err}`);
457443
assertListResults(result, null, uploadId, objectKey);
458444
abortMPU(uploadId, getAwsParams(objectKey), done);
@@ -463,9 +449,17 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
463449
it('should list the parts of a multipart upload on real AWS location ' +
464450
'with bucketMatch set to false', done => {
465451
const objectKey = `key-${Date.now()}`;
452+
console.log('[LIST TEST] Starting listParts test with bucketMatch=false');
466453
mpuSetup(awsLocationMismatch, objectKey, uploadId => {
454+
console.log('[LIST TEST] MPU setup completed, uploadId:', uploadId);
467455
const listParams = getListParams(objectKey, uploadId);
456+
console.log('[LIST TEST] listParams:', listParams);
457+
console.log('[LIST TEST] Calling listParts...');
468458
listParts(authInfo, listParams, log, (err, result) => {
459+
console.log('[LIST TEST] listParts returned - err:', err, 'result:', result ? 'present' : 'null');
460+
if (err) {
461+
console.error('[LIST TEST] Error details:', err);
462+
}
469463
assert.equal(err, null, `Error listing parts on AWS: ${err}`);
470464
assertListResults(result, null, uploadId, objectKey);
471465
abortMPU(uploadId, getAwsParamsBucketNotMatch(objectKey), done);
@@ -495,6 +489,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
495489
const listParams = getListParams(objectKey, uploadId);
496490
listParams.query['part-number-marker'] = '1';
497491
listParts(authInfo, listParams, log, (err, result) => {
492+
console.log('[PART NUMBER MARKER TEST] listParts returned, err:', err);
498493
assert.equal(err, null);
499494
assertListResults(result, 'partNumMarker', uploadId, objectKey);
500495
abortMPU(uploadId, getAwsParams(objectKey), done);
@@ -508,6 +503,7 @@ describe('Multipart Upload API with AWS Backend', function mpuTestSuite() {
508503
abortMPU(uploadId, getAwsParams(objectKey), () => {
509504
const listParams = getListParams(objectKey, uploadId);
510505
listParts(authInfo, listParams, log, err => {
506+
console.log('[LIST DELETED MPU TEST] listParts returned, err:', err);
511507
let wantedDesc = 'Error returned from AWS: ' +
512508
'The specified upload does not exist. The upload ID ' +
513509
'may be invalid, or the upload may have been aborted' +

0 commit comments

Comments
 (0)