Skip to content

Commit eab1605

Browse files
committed
website related tests migration
Issue: CLDSRV-724
1 parent bcc5e50 commit eab1605

File tree

5 files changed

+291
-294
lines changed

5 files changed

+291
-294
lines changed

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

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,45 @@
11
const assert = require('assert');
2-
const async = require('async');
2+
3+
const {
4+
S3Client,
5+
CreateBucketCommand,
6+
DeleteBucketCommand,
7+
PutBucketWebsiteCommand,
8+
PutObjectCommand,
9+
DeleteObjectCommand,
10+
PutBucketPolicyCommand,
11+
} = require('@aws-sdk/client-s3');
312
const fs = require('fs');
413
const path = require('path');
5-
6-
const { S3 } = require('aws-sdk');
14+
const async = require('async');
715

816
const conf = require('../../../../../lib/Config').config;
917
const getConfig = require('../support/config');
1018
const { makeRequest } = require('../../../raw-node/utils/makeRequest');
1119
const { WebsiteConfigTester } = require('../../lib/utility/website-util');
1220

13-
const config = getConfig('default', { signatureVersion: 'v4' });
14-
const s3 = new S3(config);
21+
const config = getConfig('default');
22+
const s3Client = new S3Client(config);
23+
const s3 = {
24+
createBucket: (params, cb) => {
25+
s3Client.send(new CreateBucketCommand(params)).then(d => cb(null, d)).catch(cb);
26+
},
27+
deleteBucket: (params, cb) => {
28+
s3Client.send(new DeleteBucketCommand(params)).then(d => cb(null, d)).catch(cb);
29+
},
30+
putBucketWebsite: (params, cb) => {
31+
s3Client.send(new PutBucketWebsiteCommand(params)).then(d => cb(null, d)).catch(cb);
32+
},
33+
putObject: (params, cb) => {
34+
s3Client.send(new PutObjectCommand(params)).then(d => cb(null, d)).catch(cb);
35+
},
36+
deleteObject: (params, cb) => {
37+
s3Client.send(new DeleteObjectCommand(params)).then(d => cb(null, d)).catch(cb);
38+
},
39+
putBucketPolicy: (params, cb) => {
40+
s3Client.send(new PutBucketPolicyCommand(params)).then(d => cb(null, d)).catch(cb);
41+
},
42+
};
1543

1644
const transport = conf.https ? 'https' : 'http';
1745
const bucket = process.env.AWS_ON_AIR ? 'awsbucketwebsitetester' :

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const { S3 } = require('aws-sdk');
1+
const { S3Client } = require('@aws-sdk/client-s3');
22

33
const conf = require('../../../../../lib/Config').config;
44
const getConfig = require('../support/config');
55
const { WebsiteConfigTester } = require('../../lib/utility/website-util');
66

77
const config = getConfig('default', { signatureVersion: 'v4' });
8-
const s3 = new S3(config);
8+
const s3 = new S3Client(config);
99

1010
// Note: To run these tests locally, you may need to edit the machine's
1111
// /etc/hosts file to include the following line:

0 commit comments

Comments
 (0)