diff --git a/tests/ctst/common/common.ts b/tests/ctst/common/common.ts index 5c991ab239..f6d33739a1 100644 --- a/tests/ctst/common/common.ts +++ b/tests/ctst/common/common.ts @@ -237,14 +237,15 @@ Then('i {string} be able to add user metadata to object {string}', } }); -Then('kafka consumed messages should not take too much place on disk', { timeout: -1 }, +const kafkaCleanerTimeout = 900000; // 15min +Then('kafka consumed messages should not take too much place on disk', { timeout: kafkaCleanerTimeout }, async function (this: Zenko) { const kfkcIntervalSeconds = parseInt(this.parameters.KafkaCleanerInterval); - const checkInterval = kfkcIntervalSeconds * (1000 + 5000); + const checkInterval = kfkcIntervalSeconds * 1000 + 5000; const timeoutID = setTimeout(() => { assert.fail('Kafka cleaner did not clean the topics within the expected time'); - }, checkInterval * 10); // Timeout after 10 Kafka cleaner intervals + }, Math.min(kafkaCleanerTimeout, checkInterval * 25)); // Timeout after 25 Kafka cleaner intervals try { const ignoredTopics = ['dead-letter']; @@ -307,6 +308,9 @@ Then('kafka consumed messages should not take too much place on disk', { timeout // If a topic remains in this array, it means it has not been cleaned assert(topics.length === 0, `Topics ${topics.join(', ')} still have not been cleaned`); + } catch (err: unknown) { + this.logger.error('Error while checking Kafka cleaner', { err }); + assert.fail(err as Error); } finally { clearTimeout(timeoutID); } diff --git a/tests/ctst/steps/dmf.ts b/tests/ctst/steps/dmf.ts index 535e26da04..759f382870 100644 --- a/tests/ctst/steps/dmf.ts +++ b/tests/ctst/steps/dmf.ts @@ -1,12 +1,13 @@ import { Then, After } from '@cucumber/cucumber'; import assert from 'assert'; +import { Utils } from 'cli-testing'; import { execShellCommand } from 'common/utils'; async function cleanDmfVolume() { await execShellCommand('rm -rf /cold-data/*'); } -Then('dmf volume should contain {int} objects', async (objectCount: number) => { +Then('dmf volume should contain {int} objects', { timeout: 5 * 60 * 1000 }, async (objectCount: number) => { let conditionOk = false; while (!conditionOk) { // Getting the number of objects inside the volume used @@ -14,6 +15,9 @@ Then('dmf volume should contain {int} objects', async (objectCount: number) => { const outStr = await execShellCommand('find /cold-data -type f | wc -l'); // we store two files per object (content and manifest.json) conditionOk = Number(outStr) === objectCount * 2; + if (!conditionOk) { + await Utils.sleep(500); + } } assert(conditionOk); }); diff --git a/tests/ctst/steps/notifications.ts b/tests/ctst/steps/notifications.ts index 54cad9e168..0fb75e90d9 100644 --- a/tests/ctst/steps/notifications.ts +++ b/tests/ctst/steps/notifications.ts @@ -1,11 +1,11 @@ import { Then, Given, When, After } from '@cucumber/cucumber'; import { strict as assert } from 'assert'; -import { S3, Utils, KafkaHelper, AWSVersionObject, NotificationDestination } from 'cli-testing'; +import { S3, Utils, KafkaHelper, AWSVersionObject, NotificationDestination, Constants } from 'cli-testing'; import { Message } from 'node-rdkafka'; import { cleanS3Bucket } from 'common/common'; import Zenko from 'world/Zenko'; -const KAFKA_TESTS_TIMEOUT = Number(process.env.KAFKA_TESTS_TIMEOUT) || 60000; +const KAFKA_TESTS_TIMEOUT = Number(process.env.KAFKA_TESTS_TIMEOUT) || Constants.DEFAULT_TIMEOUT * 1.5; const allNotificationTypes = [ 's3:ObjectCreated:Put', @@ -308,6 +308,7 @@ Then('notifications should be enabled for {string} event in destination {int}', }); Then('i should {string} a notification for {string} event in destination {int}', + { timeout: Constants.DEFAULT_TIMEOUT * 2 }, async function (this: Zenko, receive: string, notificationType: string, destination: number) { const receivedNotification = await KafkaHelper.consumeTopicUntilCondition(