From 59a887a8ae2552fc8d47fc5792627e52cc4ab2fb 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 5c991ab239..facd1dfc5b 100644 --- a/tests/ctst/common/common.ts +++ b/tests/ctst/common/common.ts @@ -101,6 +101,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 d679dad4899202f0ea74714d15950f5faa3d598a 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 facd1dfc5b..b67b0c2148 100644 --- a/tests/ctst/common/common.ts +++ b/tests/ctst/common/common.ts @@ -101,36 +101,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