Skip to content

Commit 13648a5

Browse files
CLDSRV-717: Reintroduce same account tests
S3C branches used to tests in the same account. There was no Replication account. See: https://github.com/scality/cloudserver/blob/development/7.70/tests/functional/raw-node/test/routes/routeBackbeatForReplication.js
1 parent 1f27fe8 commit 13648a5

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

tests/multipleBackend/routes/routeBackbeatForReplication.js

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,31 @@ const destinationAuthCredentials = {
2020
secretKey: destinationCreds.secretAccessKey,
2121
};
2222

23+
// Note: for S3C tests, those conf files needs to be modified beforehand
2324
const dstAccountInfo = require('../../../conf/authdata.json')
2425
.accounts.find(acc => acc.name === 'Replication');
26+
const srcAccountInfo = require('../../../conf/authdata.json')
27+
.accounts.find(acc => acc.name === 'Bart');
28+
29+
const srcBucketUtil = new BucketUtility('default', { signatureVersion: 'v4' });
30+
const srcS3 = srcBucketUtil.s3;
31+
32+
const dstBucketUtil = new BucketUtility('replication', { signatureVersion: 'v4' });
33+
const dstS3 = dstBucketUtil.s3;
34+
35+
const src = {
36+
credentials: sourceAuthCredentials,
37+
bucketUtil: srcBucketUtil,
38+
s3: srcS3,
39+
accountInfo: srcAccountInfo,
40+
};
41+
42+
const dst = {
43+
credentials: destinationAuthCredentials,
44+
bucketUtil: dstBucketUtil,
45+
s3: dstS3,
46+
accountInfo: dstAccountInfo,
47+
};
2548

2649
const testData = 'testkey data';
2750

@@ -48,12 +71,17 @@ function objectMDWithUpdatedAccountInfo(data, dstAccountInfo = null) {
4871
return objMD.getSerialized();
4972
}
5073

51-
describe('backbeat routes for replication', () => {
52-
const srcBucketUtil = new BucketUtility('default', { signatureVersion: 'v4' });
53-
const srcS3 = srcBucketUtil.s3;
74+
const scenarios = [
75+
// S3C Integration can replicate to the same account
76+
{ name: 'same account', src, dst: src },
77+
{ name: 'cross account', src, dst },
78+
];
5479

55-
const dstBucketUtil = new BucketUtility('replication', { signatureVersion: 'v4' });
56-
const dstS3 = dstBucketUtil.s3;
80+
scenarios.forEach(({ name, src, dst }) => {
81+
describe(`backbeat routes for replication (${name})`, () => {
82+
const { s3: srcS3, bucketUtil: srcBucketUtil, credentials: sourceAuthCredentials } = src;
83+
const { s3: dstS3, bucketUtil: dstBucketUtil, credentials: destinationAuthCredentials } = dst;
84+
const { accountInfo: dstAccountInfo } = dst;
5785

5886
let bucketSource;
5987
let bucketDestination;
@@ -106,7 +134,7 @@ describe('backbeat routes for replication', () => {
106134
if (err) {
107135
return next(err);
108136
}
109-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
137+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
110138
return next();
111139
}),
112140
replicateMetadata: next => makeBackbeatRequest({
@@ -171,7 +199,7 @@ describe('backbeat routes for replication', () => {
171199
if (err) {
172200
return next(err);
173201
}
174-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
202+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
175203
return next();
176204
}),
177205
replicateMetadata: next => makeBackbeatRequest({
@@ -392,7 +420,7 @@ describe('backbeat routes for replication', () => {
392420
if (err) {
393421
return next(err);
394422
}
395-
objMDNonCurrent = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
423+
objMDNonCurrent = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
396424
return next();
397425
}),
398426
getMetadataCurrent: next => makeBackbeatRequest({
@@ -408,7 +436,7 @@ describe('backbeat routes for replication', () => {
408436
if (err) {
409437
return next(err);
410438
}
411-
objMDCurrent = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
439+
objMDCurrent = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
412440
return next();
413441
}),
414442
// replicating the objects in the reverse order
@@ -494,7 +522,7 @@ describe('backbeat routes for replication', () => {
494522
if (err) {
495523
return next(err);
496524
}
497-
objMDVersion = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
525+
objMDVersion = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
498526
return next();
499527
}),
500528
replicateMetadataVersion: next => makeBackbeatRequest({
@@ -521,7 +549,7 @@ describe('backbeat routes for replication', () => {
521549
if (err) {
522550
return next(err);
523551
}
524-
objMDDeleteMarker = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
552+
objMDDeleteMarker = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
525553
return next();
526554
}),
527555
replicateMetadataDeleteMarker: next => makeBackbeatRequest({
@@ -580,7 +608,7 @@ describe('backbeat routes for replication', () => {
580608
if (err) {
581609
return next(err);
582610
}
583-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
611+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
584612
return next();
585613
}),
586614
replicateMetadata: next => makeBackbeatRequest({
@@ -642,7 +670,7 @@ describe('backbeat routes for replication', () => {
642670
if (err) {
643671
return next(err);
644672
}
645-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
673+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
646674
return next();
647675
}),
648676
replicateMetadata: next => makeBackbeatRequest({
@@ -702,7 +730,7 @@ describe('backbeat routes for replication', () => {
702730
if (err) {
703731
return next(err);
704732
}
705-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
733+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
706734
return next();
707735
}),
708736
replicateMetadata: next => makeBackbeatRequest({
@@ -783,7 +811,7 @@ describe('backbeat routes for replication', () => {
783811
if (err) {
784812
return next(err);
785813
}
786-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
814+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
787815
return next();
788816
}),
789817
replicateMetadata: next => makeBackbeatRequest({
@@ -867,7 +895,7 @@ describe('backbeat routes for replication', () => {
867895
if (err) {
868896
return next(err);
869897
}
870-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
898+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
871899
return next();
872900
}),
873901
replicateMetadata: next => makeBackbeatRequest({
@@ -947,7 +975,7 @@ describe('backbeat routes for replication', () => {
947975
if (err) {
948976
return next(err);
949977
}
950-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
978+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
951979
return next();
952980
}),
953981
replicateMetadata: next => makeBackbeatRequest({
@@ -1023,7 +1051,7 @@ describe('backbeat routes for replication', () => {
10231051
if (err) {
10241052
return next(err);
10251053
}
1026-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
1054+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
10271055
return next();
10281056
}),
10291057
replicateMetadata: next => makeBackbeatRequest({
@@ -1124,7 +1152,7 @@ describe('backbeat routes for replication', () => {
11241152
if (err) {
11251153
return next(err);
11261154
}
1127-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
1155+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
11281156
return next();
11291157
}),
11301158
replicateMetadata: next => makeBackbeatRequest({
@@ -1209,7 +1237,7 @@ describe('backbeat routes for replication', () => {
12091237
if (err) {
12101238
return next(err);
12111239
}
1212-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
1240+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
12131241
return next();
12141242
}),
12151243
replicateMetadata: next => makeBackbeatRequest({
@@ -1309,7 +1337,7 @@ describe('backbeat routes for replication', () => {
13091337
if (err) {
13101338
return next(err);
13111339
}
1312-
objMDNullReplicated = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
1340+
objMDNullReplicated = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
13131341
return next();
13141342
}),
13151343
putReplicatedNullVersion: next => makeBackbeatRequest({
@@ -1344,7 +1372,7 @@ describe('backbeat routes for replication', () => {
13441372
if (err) {
13451373
return next(err);
13461374
}
1347-
objMDVersion = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
1375+
objMDVersion = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
13481376
return next();
13491377
}),
13501378
listObjectVersionsBeforeReplicate: next => dstS3.listObjectVersions({ Bucket: bucketDestination }, next),
@@ -1432,7 +1460,7 @@ describe('backbeat routes for replication', () => {
14321460
if (err) {
14331461
return next(err);
14341462
}
1435-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
1463+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
14361464
return next();
14371465
}),
14381466
replicateMetadata: next => makeBackbeatRequest({
@@ -1523,7 +1551,7 @@ describe('backbeat routes for replication', () => {
15231551
if (err) {
15241552
return next(err);
15251553
}
1526-
objMD = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
1554+
objMD = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
15271555
return next();
15281556
}),
15291557
replicateMetadata: next => makeBackbeatRequest({
@@ -1636,7 +1664,7 @@ describe('backbeat routes for replication', () => {
16361664
if (err) {
16371665
return next(err);
16381666
}
1639-
objMDReplicated = objectMDWithUpdatedAccountInfo(data, dstAccountInfo);
1667+
objMDReplicated = objectMDWithUpdatedAccountInfo(data, src === dst ? null : dstAccountInfo);
16401668
return next();
16411669
}),
16421670
putReplicatedNullVersion: next => makeBackbeatRequest({
@@ -1688,3 +1716,4 @@ describe('backbeat routes for replication', () => {
16881716
});
16891717
});
16901718
});
1719+
});

0 commit comments

Comments
 (0)