Skip to content

Commit

Permalink
Test that federated metrics are retrieved
Browse files Browse the repository at this point in the history
Issue: ZENKO-4876
  • Loading branch information
francoisferrand committed Oct 22, 2024
1 parent 676e708 commit a08b64b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/ctst/features/pra.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 20 additions & 2 deletions tests/ctst/steps/pra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from 'steps/utils/utils';
import { CacheHelper, Constants, Identity, IdentityEnum, SuperAdmin, Utils } from 'cli-testing';
import { safeJsonParse } from 'common/utils';
import { PrometheusDriver } from 'prometheus-query';
import assert from 'assert';
import { EntityType } from 'world/Zenko';

Expand Down Expand Up @@ -328,8 +329,25 @@ 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: 70000 }, async function (this: Zenko) {
const prom = new PrometheusDriver({
endpoint: `http://${this.parameters.PrometheusService}:9090`,
baseURL: '/api/v1',
});

for (;;) {
const t = Date.now();
const metrics = await prom.series('{drSinkInstance="end2end-pra-sink"}', t - 60 * 1000, t);
if (metrics.length > 0) {
break;
}

await Utils.sleep(1000);
}
});

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({
sinkZenkoDrNamespace: 'default',
sinkZenkoDrInstance: 'end2end-pra-sink',
Expand All @@ -339,7 +357,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({
sinkZenkoDrNamespace: 'default',
sinkZenkoDrInstance: 'end2end-pra-sink',
Expand Down

0 comments on commit a08b64b

Please sign in to comment.