From ba15a551d23acca6fd1783dbc76a47d3d5292045 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Fri, 23 Aug 2024 15:06:01 +0200 Subject: [PATCH] Test that federated metrics are retrieved Issue: ZENKO-4876 --- tests/ctst/features/pra.feature | 3 ++- tests/ctst/steps/pra.ts | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/ctst/features/pra.feature b/tests/ctst/features/pra.feature index f0aede1e32..0199b137b2 100644 --- a/tests/ctst/features/pra.feature +++ b/tests/ctst/features/pra.feature @@ -18,7 +18,8 @@ Feature: PRA operations Given a DR installed Then the DR source should be in phase "Running" And the DR sink should be in phase "Running" - Then the kafka DR volume exists + And the kafka DR volume exists + And prometheus should scrap federated metrics from DR sink # Check that objects are transitioned in the DR site Given access keys for the replicated account diff --git a/tests/ctst/steps/pra.ts b/tests/ctst/steps/pra.ts index 3e05debddc..a9e663fc4c 100644 --- a/tests/ctst/steps/pra.ts +++ b/tests/ctst/steps/pra.ts @@ -14,6 +14,7 @@ import { } from 'steps/utils/utils'; import { Constants, Identity, IdentityEnum, S3, SuperAdmin, Utils } from 'cli-testing'; import { safeJsonParse } from 'common/utils'; +import { PrometheusDriver } from 'prometheus-query'; import assert from 'assert'; import { EntityType } from 'world/Zenko'; @@ -322,8 +323,19 @@ Then('the kafka DR volume exists', { timeout: volumeTimeout + 2000 }, async func assert(volumeParsed.result!['volume phase'] === 'Bound'); }); +Then('prometheus should scrap federated metrics from DR sink', { timeout: 60000 }, async function (this: Zenko) { + const prom = new PrometheusDriver({ + endpoint: `http://${this.parameters.PrometheusService}:9090`, + baseURL: '/api/v1', + }); + + const t = Date.now(); + const metrics = await prom.series('{drSinkInstance="end2end-pra-sink"}', t - 60 * 1000, t); + assert(metrics.length > 0); +}); + const failoverTimeout = 360000; -When ('I request the failover state for the DR', { timeout: failoverTimeout + 2000 }, async function (this: Zenko) { +When('I request the failover state for the DR', { timeout: failoverTimeout + 2000 }, async function (this: Zenko) { await this.zenkoDrCtl?.failover({ sinkZenkoNamespace: 'default', wait: true, @@ -332,7 +344,7 @@ When ('I request the failover state for the DR', { timeout: failoverTimeout + 20 }); const failbackTimeout = 360000; -When ('I resume operations for the DR', { timeout: failbackTimeout + 2000 }, async function (this: Zenko) { +When('I resume operations for the DR', { timeout: failbackTimeout + 2000 }, async function (this: Zenko) { await this.zenkoDrCtl?.failback({ sinkZenkoNamespace: 'default', wait: true,