Skip to content

Commit ed70012

Browse files
CLDSRV-805: Regroup and dedup versioning Get/Put
Exact same test in 2 different files regrouped. Using 1 bucket on test suite to reduce gcp quota pressure
1 parent d1b760d commit ed70012

3 files changed

Lines changed: 51 additions & 130 deletions

File tree

tests/functional/raw-node/test/GCP/bucket/getVersioning.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

tests/functional/raw-node/test/GCP/bucket/putVersioning.js

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const assert = require('assert');
2+
const arsenal = require('arsenal');
3+
const {
4+
PutBucketVersioningCommand,
5+
GetBucketVersioningCommand,
6+
CreateBucketCommand,
7+
DeleteBucketCommand,
8+
} = require('@aws-sdk/client-s3');
9+
const { GCP } = arsenal.storage.data.external.GCP;
10+
const { genBucketName, gcpRetry } = require('../../../utils/gcpUtils');
11+
const { getRealAwsConfig } =
12+
require('../../../../aws-node-sdk/test/support/awsConfig');
13+
14+
const credentialOne = 'gcpbackend';
15+
const config = getRealAwsConfig(credentialOne);
16+
const gcpClient = new GCP(config);
17+
const bucketName = genBucketName('versioning');
18+
19+
describe('GCP: Bucket Versioning', function testSuite() {
20+
this.timeout(120000);
21+
22+
before(async () => {
23+
await gcpRetry(gcpClient, new CreateBucketCommand({ Bucket: bucketName }));
24+
});
25+
26+
after(async () => {
27+
await gcpRetry(gcpClient, new DeleteBucketCommand({ Bucket: bucketName }));
28+
});
29+
30+
it('should enable bucket versioning', async () => {
31+
await gcpClient.send(new PutBucketVersioningCommand({
32+
Bucket: bucketName,
33+
VersioningConfiguration: { Status: 'Enabled' },
34+
}));
35+
36+
const res = await gcpClient.send(
37+
new GetBucketVersioningCommand({ Bucket: bucketName }));
38+
assert.strictEqual(res.Status, 'Enabled');
39+
});
40+
41+
it('should disable bucket versioning', async () => {
42+
await gcpClient.send(new PutBucketVersioningCommand({
43+
Bucket: bucketName,
44+
VersioningConfiguration: { Status: 'Suspended' },
45+
}));
46+
47+
const res = await gcpClient.send(
48+
new GetBucketVersioningCommand({ Bucket: bucketName }));
49+
assert.strictEqual(res.Status, 'Suspended');
50+
});
51+
});

0 commit comments

Comments
 (0)