From 2ea3b4e08140839355b5596e2cbc2f95175f1040 Mon Sep 17 00:00:00 2001 From: williamlardier Date: Wed, 4 Sep 2024 11:46:12 +0200 Subject: [PATCH 1/2] Test SOSAPI PUTs with a bucket having a dot in its name This allows to test that the custom route is accepting such buckets. Issue: ZENKO-4889 --- tests/ctst/common/common.ts | 16 ++++++++++++++++ tests/ctst/features/sosapi.feature | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/tests/ctst/common/common.ts b/tests/ctst/common/common.ts index 2b3f40998d..31bd3df86d 100644 --- a/tests/ctst/common/common.ts +++ b/tests/ctst/common/common.ts @@ -105,6 +105,22 @@ Given('an account', async function (this: Zenko) { await this.createAccount(); }); +Given('a {string} bucket with dot', async function (this: Zenko, versioning: string) { + this.resetCommand(); + const preName = this.getSaved('accountName') || + this.parameters.AccountName || Constants.ACCOUNT_NAME; + const bucketName = `${preName}.${Constants.BUCKET_NAME_TEST}${Utils.randomString()}`.toLocaleLowerCase(); + this.addToSaved('bucketName', bucketName); + this.addCommandParameter({ bucket: bucketName }); + await S3.createBucket(this.getCommandParameters()); + this.addToSaved('bucketVersioning', versioning); + if (versioning !== 'Non versioned') { + const versioningConfiguration = versioning === 'Versioned' ? 'Enabled' : 'Suspended'; + this.addCommandParameter({ versioningConfiguration: `Status=${versioningConfiguration}` }); + await S3.putBucketVersioning(this.getCommandParameters()); + } +}); + Given('a {string} bucket', async function (this: Zenko, versioning: string) { this.resetCommand(); const preName = this.getSaved('accountName') || diff --git a/tests/ctst/features/sosapi.feature b/tests/ctst/features/sosapi.feature index f3a6353be4..54569e7961 100644 --- a/tests/ctst/features/sosapi.feature +++ b/tests/ctst/features/sosapi.feature @@ -17,3 +17,18 @@ Feature: Veeam SOSAPI | Non versioned | invalid | capacity.xml | not accepted | | Non versioned | valid | system.xml | accepted | | Non versioned | invalid | system.xml | not accepted | + + @2.6.0 + @PreMerge + @SOSAPI + Scenario Outline: PUT routes for SOSAPI configuration files + Given a "" bucket with dot + When I PUT the "" "" XML file + Then the request should be "" + + Examples: + | versioningConfiguration | isValid | sosapiFile | requestAccepted | + | Non versioned | valid | capacity.xml | accepted | + | Non versioned | invalid | capacity.xml | not accepted | + | Non versioned | valid | system.xml | accepted | + | Non versioned | invalid | system.xml | not accepted | From 4276731336efa9d872248f1d2d998339af3a7cbc Mon Sep 17 00:00:00 2001 From: williamlardier Date: Tue, 24 Sep 2024 11:10:02 +0200 Subject: [PATCH 2/2] Deduplicate bucket creation logic Issue: ZENKO-4889 --- tests/ctst/common/common.ts | 39 ++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/tests/ctst/common/common.ts b/tests/ctst/common/common.ts index 31bd3df86d..78926f1ae8 100644 --- a/tests/ctst/common/common.ts +++ b/tests/ctst/common/common.ts @@ -105,36 +105,31 @@ Given('an account', async function (this: Zenko) { await this.createAccount(); }); -Given('a {string} bucket with dot', async function (this: Zenko, versioning: string) { - this.resetCommand(); - const preName = this.getSaved('accountName') || - this.parameters.AccountName || Constants.ACCOUNT_NAME; - const bucketName = `${preName}.${Constants.BUCKET_NAME_TEST}${Utils.randomString()}`.toLocaleLowerCase(); - this.addToSaved('bucketName', bucketName); - this.addCommandParameter({ bucket: bucketName }); - await S3.createBucket(this.getCommandParameters()); - this.addToSaved('bucketVersioning', versioning); +async function createBucket(world: Zenko, versioning: string, bucketName: string) { + world.resetCommand(); + world.addToSaved('bucketName', bucketName); + world.addCommandParameter({ bucket: bucketName }); + await S3.createBucket(world.getCommandParameters()); + world.addToSaved('bucketVersioning', versioning); if (versioning !== 'Non versioned') { const versioningConfiguration = versioning === 'Versioned' ? 'Enabled' : 'Suspended'; - this.addCommandParameter({ versioningConfiguration: `Status=${versioningConfiguration}` }); - await S3.putBucketVersioning(this.getCommandParameters()); + world.addCommandParameter({ versioningConfiguration: `Status=${versioningConfiguration}` }); + await S3.putBucketVersioning(world.getCommandParameters()); } +} + +Given('a {string} bucket with dot', async function (this: Zenko, versioning: string) { + const preName = this.getSaved('accountName') || + this.parameters.AccountName || Constants.ACCOUNT_NAME; + await createBucket(this, versioning, + `${preName}.${Constants.BUCKET_NAME_TEST}${Utils.randomString()}`.toLocaleLowerCase()); }); Given('a {string} bucket', async function (this: Zenko, versioning: string) { - this.resetCommand(); const preName = this.getSaved('accountName') || this.parameters.AccountName || Constants.ACCOUNT_NAME; - const bucketName = `${preName}${Constants.BUCKET_NAME_TEST}${Utils.randomString()}`.toLocaleLowerCase(); - this.addToSaved('bucketName', bucketName); - this.addCommandParameter({ bucket: bucketName }); - await S3.createBucket(this.getCommandParameters()); - this.addToSaved('bucketVersioning', versioning); - if (versioning !== 'Non versioned') { - const versioningConfiguration = versioning === 'Versioned' ? 'Enabled' : 'Suspended'; - this.addCommandParameter({ versioningConfiguration: `Status=${versioningConfiguration}` }); - await S3.putBucketVersioning(this.getCommandParameters()); - } + await createBucket(this, versioning, + `${preName}${Constants.BUCKET_NAME_TEST}${Utils.randomString()}`.toLocaleLowerCase()); }); Given('an existing bucket {string} {string} versioning, {string} ObjectLock {string} retention mode', async function