Skip to content

Commit 5b5a6bd

Browse files
authored
refactor(samples): Add more metadata to dual-region sample (#2016)
1 parent 9ce888b commit 5b5a6bd

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

samples/createBucketWithDualRegion.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ function main(
5858
},
5959
});
6060

61-
console.log(`${bucket.name} created in '${region1}' and '${region2}'`);
61+
console.log(`Created '${bucket.name}'`);
62+
console.log(`- location: '${bucket.metadata.location}'`);
63+
console.log(`- locationType: '${bucket.metadata.locationType}'`);
64+
console.log(
65+
`- customPlacementConfig: '${JSON.stringify(
66+
bucket.metadata.customPlacementConfig
67+
)}'`
68+
);
6269
}
6370

6471
createDualRegionBucket().catch(console.error);

samples/system-test/buckets.test.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,14 @@ it('should create a dual-region bucket', async () => {
223223
`node createBucketWithDualRegion.js ${bucketNameDualRegion} ${DUAL_REGION.LOCATION} ${DUAL_REGION.REGIONS[0]} ${DUAL_REGION.REGIONS[1]}`
224224
);
225225

226-
assert.include(
227-
output,
228-
`${bucketNameDualRegion} created in '${DUAL_REGION.REGIONS[0]}' and '${DUAL_REGION.REGIONS[1]}'`
229-
);
230-
226+
// Ensure the sample outputs the desired result
227+
assert.include(output, bucketNameDualRegion);
228+
assert.include(output, DUAL_REGION.LOCATION);
229+
assert.include(output, DUAL_REGION.REGIONS[0]);
230+
assert.include(output, DUAL_REGION.REGIONS[1]);
231+
assert.include(output, 'dual-region');
232+
233+
// Make API request for further verification
231234
const [exists] = await dualRegionBucket.exists();
232235
assert.strictEqual(exists, true);
233236

0 commit comments

Comments
 (0)