Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added fix_s3_callbacks.py
Empty file.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
"@aws-sdk/client-s3": "^3.705.0",
"@aws-sdk/credential-providers": "^3.864.0",
"@aws-sdk/middleware-retry": "^3.374.0",
"@aws-sdk/protocol-http": "^3.374.0",
"@aws-sdk/s3-request-presigner": "^3.901.0",
"@aws-sdk/signature-v4": "^3.374.0",
"@azure/storage-blob": "^12.28.0",
"@hapi/joi": "^17.1.1",
"@smithy/node-http-handler": "^3.0.0",
"arsenal": "git+https://github.com/scality/Arsenal#8.2.32",
"async": "2.6.4",
"aws-sdk": "^2.1692.0",
Expand Down Expand Up @@ -86,7 +90,7 @@
"scripts": {
"cloudserver": "S3METADATA=mongodb npm-run-all --parallel start_dataserver start_s3server",
"dev": "nodemon --exec \"yarn run start\"",
"ft_awssdk": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
"ft_awssdk": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/bucket --exit",
"ft_awssdk_aws": "cd tests/functional/aws-node-sdk && AWS_ON_AIR=true mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
"ft_awssdk_buckets": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/bucket --exit",
"ft_awssdk_objects_misc": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/legacy test/object test/service test/support --exit",
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/aws-node-sdk/lib/utility/checkError.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const assert = require('assert');

function checkError(err, code, statusCode) {
assert(err, 'Expected error but found none');
assert.strictEqual(err.code, code);
assert.strictEqual(err.statusCode, statusCode);
assert.strictEqual(err.name, code);
assert.strictEqual(err.$metadata.httpStatusCode, statusCode);
}

module.exports = checkError;
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function _deleteVersionList(versionList, bucket, callback) {
function checkOneVersion(s3, bucket, versionId, callback) {
return s3Client.send(new ListObjectVersionsCommand({ Bucket: bucket })).then(data => {
assert.strictEqual(data.Versions.length, 1);

if (versionId) {
assert.strictEqual(data.Versions[0].VersionId, versionId);
}
Expand Down
35 changes: 15 additions & 20 deletions tests/functional/aws-node-sdk/lib/utility/website-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ const async = require('async');
const fs = require('fs');
const path = require('path');
const url = require('url');
const { CreateBucketCommand,
DeleteBucketCommand,
PutBucketWebsiteCommand,
DeleteObjectCommand,
PutObjectCommand } = require('@aws-sdk/client-s3');

const { makeRequest } = require('../../../raw-node/utils/makeRequest');

Expand Down Expand Up @@ -352,41 +357,31 @@ class WebsiteConfigTester {
}

static createPutBucketWebsite(s3, bucket, bucketACL, objects, done) {
s3.createBucket({ Bucket: bucket, ACL: bucketACL },
err => {
if (err) {
return done(err);
}
s3.send(new CreateBucketCommand({ Bucket: bucket, ACL: bucketACL })).then(() => {
const webConfig = new WebsiteConfigTester('index.html',
'error.html');
return s3.putBucketWebsite({ Bucket: bucket,
WebsiteConfiguration: webConfig }, err => {
if (err) {
return done(err);
}
return async.forEachOf(objects,
return s3.send(new PutBucketWebsiteCommand({ Bucket: bucket,
WebsiteConfiguration: webConfig })).then(() => async.forEachOf(objects,
(acl, object, next) => {
s3.putObject({ Bucket: bucket,
s3.send(new PutObjectCommand({ Bucket: bucket,
Key: `${object}.html`,
ACL: acl,
Body: fs.readFileSync(path.join(__dirname,
`/../../test/object/websiteFiles/${object}.html`)),
},
next);
}, done);
});
});
})).then(() => next()).catch(next);
}, done));
}).catch(err => done(err));
}

static deleteObjectsThenBucket(s3, bucket, objects, done) {
async.forEachOf(objects, (acl, object, next) => {
s3.deleteObject({ Bucket: bucket,
Key: `${object}.html` }, next);
s3.send(new DeleteObjectCommand({ Bucket: bucket,
Key: `${object}.html` })).then(() => next()).catch(next);
}, err => {
if (err) {
return done(err);
}
return s3.deleteBucket({ Bucket: bucket }, done);
return s3.send(new DeleteBucketCommand({ Bucket: bucket })).then(() => done()).catch(done);
});
}
}
Expand Down
Loading
Loading