From d19a7a9e28afee507686e74784453ef11691f5ec Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Mon, 18 Nov 2024 16:18:14 +0100 Subject: [PATCH] ctst: check result of object creation steps Issue: ZENKO-4928 --- tests/ctst/common/common.ts | 18 ++++++++++++------ tests/ctst/steps/utils/utils.ts | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/ctst/common/common.ts b/tests/ctst/common/common.ts index a5066165b..eebaaea94 100644 --- a/tests/ctst/common/common.ts +++ b/tests/ctst/common/common.ts @@ -148,17 +148,20 @@ Given('an existing bucket {string} {string} versioning, {string} ObjectLock {str Given('{int} objects {string} of size {int} bytes', async function (this: Zenko, numberObjects: number, objectName: string, sizeBytes: number) { - await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes); + const result = await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes); + assert.ifError(result?.stderr || result?.err); }); Given('{int} mpu objects {string} of size {int} bytes', async function (this: Zenko, numberObjects: number, objectName: string, sizeBytes: number) { - await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes, undefined, 1); + const result = await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes, undefined, 1); + assert.ifError(result?.stderr || result?.err); }); Given('{string} is copied to {string}', async function (this: Zenko, sourceObject: string, destinationObject: string) { - await copyObject(this, sourceObject, destinationObject); + const result = await copyObject(this, sourceObject, destinationObject); + assert.ifError(result?.stderr || result?.err); }); Given('{int} objects {string} of size {int} bytes on {string} site', @@ -170,17 +173,20 @@ Given('{int} objects {string} of size {int} bytes on {string} site', } else { Identity.useIdentity(IdentityEnum.ACCOUNT, Zenko.sites['source'].accountName); } - await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes); + const result = await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes); + assert.ifError(result?.stderr || result?.err); }); Given('{int} objects {string} of size {int} bytes with user metadata {string}', async function (this: Zenko, numberObjects: number, objectName: string, sizeBytes: number, userMD: string) { - await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes, userMD); + const result = await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes, userMD); + assert.ifError(result?.stderr || result?.err); }); Given('{int} mpu objects {string} of size {int} bytes with user metadata {string}', async function (this: Zenko, numberObjects: number, objectName: string, sizeBytes: number, userMD: string) { - await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes, userMD); + const result = await addMultipleObjects.call(this, numberObjects, objectName, sizeBytes, userMD); + assert.ifError(result?.stderr || result?.err); }); Given('a tag on object {string} with key {string} and value {string}', diff --git a/tests/ctst/steps/utils/utils.ts b/tests/ctst/steps/utils/utils.ts index 394b012c0..9469a974c 100644 --- a/tests/ctst/steps/utils/utils.ts +++ b/tests/ctst/steps/utils/utils.ts @@ -274,6 +274,7 @@ async function copyObject(world: Zenko, srcObjectName?: string, dstObjectName?: const versionId = extractPropertyFromResults(result, 'VersionId'); world.saveCreatedObject(key, versionId || ''); world.setResult(result); + return result; } async function putObject(world: Zenko, objectName?: string, content?: string) {