-
Notifications
You must be signed in to change notification settings - Fork 255
Expand file tree
/
Copy pathgetVersioning.js
More file actions
64 lines (56 loc) · 2.06 KB
/
getVersioning.js
File metadata and controls
64 lines (56 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const assert = require('assert');
const arsenal = require('arsenal');
const {
PutBucketVersioningCommand,
GetBucketVersioningCommand,
CreateBucketCommand,
DeleteBucketCommand,
} = require('@aws-sdk/client-s3');
const { GCP } = arsenal.storage.data.external.GCP;
const { genBucketName, gcpRetry } = require('../../../utils/gcpUtils');
const { getRealAwsConfig } =
require('../../../../aws-node-sdk/test/support/awsConfig');
const credentialOne = 'gcpbackend';
const verEnabledObj = 'Enabled';
const verDisabledObj = 'Suspended';
describe('GCP: GET Bucket Versioning', () => {
const config = getRealAwsConfig(credentialOne);
const gcpClient = new GCP(config);
beforeEach(async function beforeFn() {
this.currentTest.bucketName = genBucketName('getversioning');
await gcpRetry(
gcpClient,
new CreateBucketCommand({
Bucket: this.currentTest.bucketName,
}),
);
});
afterEach(async function afterFn() {
await gcpRetry(
gcpClient,
new DeleteBucketCommand({
Bucket: this.currentTest.bucketName,
}),
);
});
it('should verify bucket versioning is enabled', async function testFn() {
await gcpClient.send(new PutBucketVersioningCommand({
Bucket: this.test.bucketName,
VersioningConfiguration: { Status: 'Enabled' },
}));
const res = await gcpClient.send(new GetBucketVersioningCommand({
Bucket: this.test.bucketName,
}));
assert.deepStrictEqual(res.Status, verEnabledObj);
});
it('should verify bucket versioning is disabled', async function testFn() {
await gcpClient.send(new PutBucketVersioningCommand({
Bucket: this.test.bucketName,
VersioningConfiguration: { Status: 'Suspended' },
}));
const res = await gcpClient.send(new GetBucketVersioningCommand({
Bucket: this.test.bucketName,
}));
assert.deepStrictEqual(res.Status, verDisabledObj);
});
});