From 2c7468abfac2c5fedefa08c362af5bd778c20f82 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Mon, 29 Sep 2025 11:27:26 +0300 Subject: [PATCH 01/18] tests: rename maint options according to the latest client options --- .../client/lib/tests/test-scenario/configuration.e2e.ts | 8 ++++---- .../lib/tests/test-scenario/connection-handoff.e2e.ts | 8 ++++---- .../client/lib/tests/test-scenario/negative-tests.e2e.ts | 2 +- .../lib/tests/test-scenario/push-notification.e2e.ts | 2 +- .../client/lib/tests/test-scenario/test-scenario.util.ts | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/client/lib/tests/test-scenario/configuration.e2e.ts b/packages/client/lib/tests/test-scenario/configuration.e2e.ts index a648375f6e..a352a8f10e 100644 --- a/packages/client/lib/tests/test-scenario/configuration.e2e.ts +++ b/packages/client/lib/tests/test-scenario/configuration.e2e.ts @@ -11,7 +11,7 @@ import { } from "./test-scenario.util"; import { createClient } from "../../.."; import { FaultInjectorClient } from "./fault-injector-client"; -import { MovingEndpointType } from "../../../dist/lib/client/enterprise-maintenance-manager"; +import { MovingEndpointType } from "../../../lib/client/enterprise-maintenance-manager"; import { RedisTcpSocketOptions } from "../../client/socket"; describe("Client Configuration and Handshake", () => { @@ -59,7 +59,7 @@ describe("Client Configuration and Handshake", () => { it(`clientHandshakeWithEndpointType '${endpointType}'`, async () => { try { client = await createTestClient(clientConfig, { - maintMovingEndpointType: endpointType, + maintEndpointType: endpointType }); client.on("error", () => {}); @@ -154,7 +154,7 @@ describe("Client Configuration and Handshake", () => { describe("Feature Enablement", () => { it("connectionHandshakeIncludesEnablingNotifications", async () => { client = await createTestClient(clientConfig, { - maintPushNotifications: "enabled", + maintNotifications: "enabled" }); const { action_id } = await faultInjectorClient.migrateAndBindAction({ @@ -180,7 +180,7 @@ describe("Client Configuration and Handshake", () => { it("disabledDontReceiveNotifications", async () => { try { client = await createTestClient(clientConfig, { - maintPushNotifications: "disabled", + maintNotifications: "disabled", socket: { reconnectStrategy: false } diff --git a/packages/client/lib/tests/test-scenario/connection-handoff.e2e.ts b/packages/client/lib/tests/test-scenario/connection-handoff.e2e.ts index 3fbf5e38d4..95f7ead253 100644 --- a/packages/client/lib/tests/test-scenario/connection-handoff.e2e.ts +++ b/packages/client/lib/tests/test-scenario/connection-handoff.e2e.ts @@ -86,25 +86,25 @@ describe("Connection Handoff", () => { { name: "external-ip", clientOptions: { - maintMovingEndpointType: "external-ip", + maintEndpointType: "external-ip", }, }, { name: "external-fqdn", clientOptions: { - maintMovingEndpointType: "external-fqdn", + maintEndpointType: "external-fqdn", }, }, { name: "auto", clientOptions: { - maintMovingEndpointType: "auto", + maintEndpointType: "auto", }, }, { name: "none", clientOptions: { - maintMovingEndpointType: "none", + maintEndpointType: "none", }, }, ]; diff --git a/packages/client/lib/tests/test-scenario/negative-tests.e2e.ts b/packages/client/lib/tests/test-scenario/negative-tests.e2e.ts index 9e90b80c50..5155877701 100644 --- a/packages/client/lib/tests/test-scenario/negative-tests.e2e.ts +++ b/packages/client/lib/tests/test-scenario/negative-tests.e2e.ts @@ -7,7 +7,7 @@ describe("Negative tests", () => { () => createClient({ RESP: 2, - maintPushNotifications: "enabled", + maintNotifications: "enabled", }), "Error: Graceful Maintenance is only supported with RESP3", ); diff --git a/packages/client/lib/tests/test-scenario/push-notification.e2e.ts b/packages/client/lib/tests/test-scenario/push-notification.e2e.ts index 9962d0a02d..839eed091d 100644 --- a/packages/client/lib/tests/test-scenario/push-notification.e2e.ts +++ b/packages/client/lib/tests/test-scenario/push-notification.e2e.ts @@ -140,7 +140,7 @@ describe("Push Notifications", () => { describe("Push Notifications Disabled - Client", () => { beforeEach(async () => { client = await createTestClient(clientConfig, { - maintPushNotifications: "disabled", + maintNotifications: "disabled", }); client.on("error", (_err) => { diff --git a/packages/client/lib/tests/test-scenario/test-scenario.util.ts b/packages/client/lib/tests/test-scenario/test-scenario.util.ts index c98ba90fe1..1a0c2f244f 100644 --- a/packages/client/lib/tests/test-scenario/test-scenario.util.ts +++ b/packages/client/lib/tests/test-scenario/test-scenario.util.ts @@ -163,8 +163,8 @@ export async function createTestClient( password: clientConfig.password, username: clientConfig.username, RESP: 3, - maintPushNotifications: "auto", - maintMovingEndpointType: "auto", + maintNotifications: "auto", + maintEndpointType: "auto", ...options, }); From f0023d4e9712c726b8e813941548e13ded7ad947 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Mon, 29 Sep 2025 11:38:50 +0300 Subject: [PATCH 02/18] tests: adjust env variables cae repo uses RE_FAULT_INJECTOR_URL for fault injector DATABASE_NAME is needed to choose from the many databases in cae --- .../client/lib/tests/test-scenario/test-scenario.util.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/client/lib/tests/test-scenario/test-scenario.util.ts b/packages/client/lib/tests/test-scenario/test-scenario.util.ts index 1a0c2f244f..96df0acbd6 100644 --- a/packages/client/lib/tests/test-scenario/test-scenario.util.ts +++ b/packages/client/lib/tests/test-scenario/test-scenario.util.ts @@ -43,13 +43,13 @@ export function getEnvConfig(): EnvConfig { ); } - if (!process.env.FAULT_INJECTION_API_URL) { - throw new Error("FAULT_INJECTION_API_URL environment variable must be set"); + if (!process.env.RE_FAULT_INJECTOR_URL) { + throw new Error("RE_FAULT_INJECTOR_URL environment variable must be set"); } return { redisEndpointsConfigPath: process.env.REDIS_ENDPOINTS_CONFIG_PATH, - faultInjectorUrl: process.env.FAULT_INJECTION_API_URL, + faultInjectorUrl: process.env.RE_FAULT_INJECTOR_URL, }; } @@ -86,7 +86,7 @@ export interface RedisConnectionConfig { */ export function getDatabaseConfig( databasesConfig: DatabasesConfig, - databaseName?: string + databaseName = process.env.DATABASE_NAME ): RedisConnectionConfig { const dbConfig = databaseName ? databasesConfig[databaseName] From 8aa69797b4d9c5d017e36b7a12bdcf09d9feafd9 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Mon, 29 Sep 2025 13:15:28 +0300 Subject: [PATCH 03/18] tests: fix connection cleanup test --- .../client/lib/tests/test-scenario/connection-handoff.e2e.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/lib/tests/test-scenario/connection-handoff.e2e.ts b/packages/client/lib/tests/test-scenario/connection-handoff.e2e.ts index 95f7ead253..7a9a4c24df 100644 --- a/packages/client/lib/tests/test-scenario/connection-handoff.e2e.ts +++ b/packages/client/lib/tests/test-scenario/connection-handoff.e2e.ts @@ -156,6 +156,7 @@ describe("Connection Handoff", () => { describe("Connection Cleanup", () => { it("should shut down old connection", async () => { + client = await createTestClient(clientConfig); const spyObject = spyOnTemporaryClientInstanceMethod(client, "destroy"); const { action_id: lowTimeoutBindAndMigrateActionId } = From 61e47a24756b7adb1735726275153eb7ff60edfc Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Wed, 1 Oct 2025 18:40:22 +0300 Subject: [PATCH 04/18] --wip-- [skip ci] --- .../client/lib/tests/test-scenario/fault-injector-client.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index 13c81412b1..c9c092a111 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -87,6 +87,12 @@ export class FaultInjectorClient { while (Date.now() - startTime < maxWaitTime) { const action = await this.getActionStatus(actionId); + if (action.status === "failed") { + throw new Error( + `Action id: ${actionId} failed! Error: ${action.error}` + ); + } + if (["finished", "failed", "success"].includes(action.status)) { return action; } From b28950e6a1a25d1901d8ba5b8d4a0450927ea437 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Thu, 2 Oct 2025 21:59:28 +0300 Subject: [PATCH 05/18] --wip-- [skip ci] --- .../timeout-during-notifications.e2e.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts index a60aacb703..2f2124d03b 100644 --- a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts +++ b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts @@ -62,6 +62,23 @@ describe("Timeout Handling During Notifications", () => { }); await client.flushAll(); + + // Ensure the endpoint is pointing at the correct node before each test + try{ + const { action_id: bindActionId } = await faultInjectorClient.triggerAction( + { + type: "bind", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + } + ); + await faultInjectorClient.waitForAction(bindActionId); + } catch(error) { + + } + }); afterEach(() => { From f23ea842e63fb5d7e973be817de475ed62615854 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 10:57:04 +0300 Subject: [PATCH 06/18] --wip-- [skip ci] --- .../lib/tests/test-scenario/fault-injector-client.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index c9c092a111..cca655bc75 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -51,6 +51,12 @@ export class FaultInjectorClient { public triggerAction( action: ActionRequest ): Promise { + if(action.type === 'sequence_of_actions') { + //@ts-ignore + console.log(`trigger sequence: ${action.parameters.actions.map(a => a.type).join(', ')}`); + } else { + console.log(`trigger action: ${action.type}`); + } return this.#request("POST", "/action", action); } @@ -88,12 +94,14 @@ export class FaultInjectorClient { const action = await this.getActionStatus(actionId); if (action.status === "failed") { + console.log(`action ${actionId} failed`); throw new Error( `Action id: ${actionId} failed! Error: ${action.error}` ); } if (["finished", "failed", "success"].includes(action.status)) { + console.log(`action ${actionId} complete`); return action; } From b21f3a934a6b3466fd0b741d94c343a397911b48 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 12:57:25 +0300 Subject: [PATCH 07/18] --wip-- [skip ci] --- .../tests/test-scenario/push-notification.e2e.ts | 14 ++++++++++++++ .../timeout-during-notifications.e2e.ts | 4 +--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/client/lib/tests/test-scenario/push-notification.e2e.ts b/packages/client/lib/tests/test-scenario/push-notification.e2e.ts index 839eed091d..c9c706d4e6 100644 --- a/packages/client/lib/tests/test-scenario/push-notification.e2e.ts +++ b/packages/client/lib/tests/test-scenario/push-notification.e2e.ts @@ -55,6 +55,20 @@ describe("Push Notifications", () => { client = await createTestClient(clientConfig); await client.flushAll(); + + // Ensure the endpoint is pointing at the correct node before each test + try{ + const { action_id: bindActionId } = await faultInjectorClient.triggerAction( + { + type: "bind", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + } + ); + await faultInjectorClient.waitForAction(bindActionId); + } catch(error) { } }); it("should receive MOVING, MIGRATING, and MIGRATED push notifications", async () => { diff --git a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts index 2f2124d03b..550b437d79 100644 --- a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts +++ b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts @@ -75,9 +75,7 @@ describe("Timeout Handling During Notifications", () => { } ); await faultInjectorClient.waitForAction(bindActionId); - } catch(error) { - - } + } catch(error) { } }); From f2cac960394877e47d57d0258020a0c2de34c5e1 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 14:09:09 +0300 Subject: [PATCH 08/18] --wip-- [skip ci] --- .../tests/test-scenario/timeout-during-notifications.e2e.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts index 550b437d79..5a43bdf7a8 100644 --- a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts +++ b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts @@ -178,7 +178,7 @@ describe("Timeout Handling During Notifications", () => { "Command Timeout error should be instanceof Error" ); assert.ok( - durationMigrate > NORMAL_COMMAND_TIMEOUT && + durationMigrate >= NORMAL_COMMAND_TIMEOUT && durationMigrate < NORMAL_COMMAND_TIMEOUT * 1.1, `Normal command should timeout within normal timeout ms` ); @@ -213,7 +213,7 @@ describe("Timeout Handling During Notifications", () => { "Command Timeout error should be instanceof Error" ); assert.ok( - durationBind > NORMAL_COMMAND_TIMEOUT && + durationBind >= NORMAL_COMMAND_TIMEOUT && durationBind < NORMAL_COMMAND_TIMEOUT * 1.1, `Normal command should timeout within normal timeout ms` ); From 88a1bd0790c6b8f33bfaca96b419cad2c8d8f09d Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 15:05:07 +0300 Subject: [PATCH 09/18] --wip-- [skip ci] --- .../tests/test-scenario/fault-injector-client.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index cca655bc75..16adb48af0 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -93,6 +93,18 @@ export class FaultInjectorClient { while (Date.now() - startTime < maxWaitTime) { const action = await this.getActionStatus(actionId); + if(["finished", "failed", "success"].includes(action.status)) { + const { action_id: statusId } = await this.triggerAction({ + type: 'execute_rladmin_command', + parameters: { + rladmin_command: "status" + } + }) + const status = await this.getActionStatus(statusId); + console.log('status'); + console.log(status.output); + } + if (action.status === "failed") { console.log(`action ${actionId} failed`); throw new Error( @@ -100,7 +112,7 @@ export class FaultInjectorClient { ); } - if (["finished", "failed", "success"].includes(action.status)) { + if (["finished", "success"].includes(action.status)) { console.log(`action ${actionId} complete`); return action; } From 055c5edcbd9091bee580c67d76ae21c0b13e7033 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 15:16:59 +0300 Subject: [PATCH 10/18] --wip-- [skip ci] --- .../test-scenario/fault-injector-client.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index 16adb48af0..684b11d952 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -48,7 +48,7 @@ export class FaultInjectorClient { * @param action The action request to trigger * @throws {Error} When the HTTP request fails or response cannot be parsed as JSON */ - public triggerAction( + public async triggerAction( action: ActionRequest ): Promise { if(action.type === 'sequence_of_actions') { @@ -57,9 +57,23 @@ export class FaultInjectorClient { } else { console.log(`trigger action: ${action.type}`); } + await this.printStatus(); return this.#request("POST", "/action", action); } + public async printStatus() { + const action = { + type: 'execute_rladmin_command', + parameters: { + rladmin_command: "status", + bdb_id: "1" + } + } + const { action_id } = await this.#request<{action_id: string}>("POST", "/action", action); + const status = await this.waitForAction(action_id); + console.log(status.output); + } + /** * Gets the status of a specific action. * @param actionId The ID of the action to check @@ -133,6 +147,8 @@ export class FaultInjectorClient { const bdbIdStr = bdbId.toString(); const clusterIndexStr = clusterIndex.toString(); + await this.printStatus(); + return this.triggerAction<{ action_id: string; }>({ From 554920d5225778dd1c6f49084ec53b8ee3866948 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 15:20:16 +0300 Subject: [PATCH 11/18] --wip-- [skip ci] --- .../lib/tests/test-scenario/fault-injector-client.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index 684b11d952..6ce44ce8c4 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -107,18 +107,6 @@ export class FaultInjectorClient { while (Date.now() - startTime < maxWaitTime) { const action = await this.getActionStatus(actionId); - if(["finished", "failed", "success"].includes(action.status)) { - const { action_id: statusId } = await this.triggerAction({ - type: 'execute_rladmin_command', - parameters: { - rladmin_command: "status" - } - }) - const status = await this.getActionStatus(statusId); - console.log('status'); - console.log(status.output); - } - if (action.status === "failed") { console.log(`action ${actionId} failed`); throw new Error( From 40af0c4ca199294ec51063f10a8fd4311bbee8a8 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 15:24:19 +0300 Subject: [PATCH 12/18] --wip-- [skip ci] --- .../client/lib/tests/test-scenario/fault-injector-client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index 6ce44ce8c4..1231fe23bf 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -71,7 +71,8 @@ export class FaultInjectorClient { } const { action_id } = await this.#request<{action_id: string}>("POST", "/action", action); const status = await this.waitForAction(action_id); - console.log(status.output); + //@ts-ignore + console.log(status.output.output); } /** From 0649c5f2893ba7904598ed23dd0bb049ec1fa550 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 15:29:59 +0300 Subject: [PATCH 13/18] --wip-- [skip ci] --- .../test-scenario/fault-injector-client.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index 1231fe23bf..abb3f96217 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -133,6 +133,36 @@ export class FaultInjectorClient { bdbId: string | number; clusterIndex: string | number; }) { + + const { action_id: migrateActionId } = await this.triggerAction({ + type: "migrate", + parameters: { + cluster_index: clusterIndex, + bdb_id: bdbId.toString(), + }, + }); + + await this.waitForAction(migrateActionId); + + const { action_id: bindActionId } = await this.triggerAction( + { + type: "bind", + parameters: { + bdb_id: bdbId.toString(), + cluster_index: clusterIndex, + }, + } + ); + await this.waitForAction(bindActionId); + }; + + async migrateAndBindAction1({ + bdbId, + clusterIndex, + }: { + bdbId: string | number; + clusterIndex: string | number; + }) { const bdbIdStr = bdbId.toString(); const clusterIndexStr = clusterIndex.toString(); From ad0cd944f7c01d9bf4edbb89c59320b394d8da93 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 15:48:16 +0300 Subject: [PATCH 14/18] --wip-- [skip ci] --- .../client/lib/tests/test-scenario/fault-injector-client.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index abb3f96217..e96ce2d319 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -144,7 +144,7 @@ export class FaultInjectorClient { await this.waitForAction(migrateActionId); - const { action_id: bindActionId } = await this.triggerAction( + return this.triggerAction( { type: "bind", parameters: { @@ -153,7 +153,6 @@ export class FaultInjectorClient { }, } ); - await this.waitForAction(bindActionId); }; async migrateAndBindAction1({ From 4eae14f2352cbecdfddf45753c2f8d171f5192b9 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 17:35:25 +0300 Subject: [PATCH 15/18] --wip-- [skip ci] --- packages/client/lib/tests/test-scenario/fault-injector-client.ts | 1 + .../lib/tests/test-scenario/timeout-during-notifications.e2e.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index e96ce2d319..4c49e1d4cc 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -178,6 +178,7 @@ export class FaultInjectorClient { type: "migrate", params: { cluster_index: clusterIndexStr, + bdb_id: bdbIdStr, }, }, { diff --git a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts index 5a43bdf7a8..37bcb8cbb9 100644 --- a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts +++ b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts @@ -161,6 +161,7 @@ describe("Timeout Handling During Notifications", () => { type: "migrate", parameters: { cluster_index: 0, + bdb_id: clientConfig.bdbId.toString(), }, }); From 048063c1a53d0fbfdae8e965825d684a2100bf29 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Fri, 3 Oct 2025 17:42:20 +0300 Subject: [PATCH 16/18] --wip-- [skip ci] --- .../tests/test-scenario/pn-failover.e2e.ts | 240 ++++++++++++++++++ .../test-scenario/push-notification.e2e.ts | 111 -------- .../timeout-during-notifications.e2e.ts | 79 ------ .../tests/test-scenario/to-failover.e2e.ts | 166 ++++++++++++ 4 files changed, 406 insertions(+), 190 deletions(-) create mode 100644 packages/client/lib/tests/test-scenario/pn-failover.e2e.ts create mode 100644 packages/client/lib/tests/test-scenario/to-failover.e2e.ts diff --git a/packages/client/lib/tests/test-scenario/pn-failover.e2e.ts b/packages/client/lib/tests/test-scenario/pn-failover.e2e.ts new file mode 100644 index 0000000000..dbfa037b23 --- /dev/null +++ b/packages/client/lib/tests/test-scenario/pn-failover.e2e.ts @@ -0,0 +1,240 @@ +import assert from "node:assert"; +import diagnostics_channel from "node:diagnostics_channel"; +import { FaultInjectorClient } from "./fault-injector-client"; +import { + createTestClient, + getDatabaseConfig, + getDatabaseConfigFromEnv, + getEnvConfig, + RedisConnectionConfig, +} from "./test-scenario.util"; +import { createClient } from "../../.."; +import { DiagnosticsEvent } from "../../client/enterprise-maintenance-manager"; +import { before } from "mocha"; + +describe("Push Notifications", () => { + const createNotificationMessageHandler = ( + result: Record, + notifications: Array + ) => { + return (message: unknown) => { + if (notifications.includes((message as DiagnosticsEvent).type)) { + const event = message as DiagnosticsEvent; + result[event.type] = (result[event.type] ?? 0) + 1; + } + }; + }; + + let onMessageHandler: ReturnType; + let clientConfig: RedisConnectionConfig; + let client: ReturnType>; + let faultInjectorClient: FaultInjectorClient; + + before(() => { + const envConfig = getEnvConfig(); + const redisConfig = getDatabaseConfigFromEnv( + envConfig.redisEndpointsConfigPath + ); + + faultInjectorClient = new FaultInjectorClient(envConfig.faultInjectorUrl); + clientConfig = getDatabaseConfig(redisConfig); + }); + + afterEach(() => { + if (onMessageHandler!) { + diagnostics_channel.unsubscribe("redis.maintenance", onMessageHandler); + } + + if (client && client.isOpen) { + client.destroy(); + } + }); + + describe("Push Notifications Enabled", () => { + beforeEach(async () => { + client = await createTestClient(clientConfig); + + await client.flushAll(); + + // Ensure the endpoint is pointing at the correct node before each test + try{ + const { action_id: bindActionId } = await faultInjectorClient.triggerAction( + { + type: "bind", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + } + ); + await faultInjectorClient.waitForAction(bindActionId); + } catch(error) { } + }); + + it("should receive FAILING_OVER and FAILED_OVER push notifications", async () => { + const notifications: Array = [ + "FAILING_OVER", + "FAILED_OVER", + ]; + + const diagnosticsMap: Record = {}; + + onMessageHandler = createNotificationMessageHandler( + diagnosticsMap, + notifications + ); + + diagnostics_channel.subscribe("redis.maintenance", onMessageHandler); + + const { action_id: failoverActionId } = + await faultInjectorClient.triggerAction({ + type: "failover", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + }); + + await faultInjectorClient.waitForAction(failoverActionId); + + assert.strictEqual( + diagnosticsMap.FAILING_OVER, + 1, + "Should have received exactly one FAILING_OVER notification" + ); + assert.strictEqual( + diagnosticsMap.FAILED_OVER, + 1, + "Should have received exactly one FAILED_OVER notification" + ); + }); + }); + + describe("Push Notifications Disabled - Client", () => { + beforeEach(async () => { + client = await createTestClient(clientConfig, { + maintNotifications: "disabled", + }); + + client.on("error", (_err) => { + // Expect the socket to be closed + // Ignore errors + }); + + await client.flushAll(); + }); + + it("should NOT receive FAILING_OVER and FAILED_OVER push notifications", async () => { + const notifications: Array = [ + "FAILING_OVER", + "FAILED_OVER", + ]; + + const diagnosticsMap: Record = {}; + + onMessageHandler = createNotificationMessageHandler( + diagnosticsMap, + notifications + ); + + diagnostics_channel.subscribe("redis.maintenance", onMessageHandler); + + const { action_id: failoverActionId } = + await faultInjectorClient.triggerAction({ + type: "failover", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + }); + + await faultInjectorClient.waitForAction(failoverActionId); + + assert.strictEqual( + diagnosticsMap.FAILING_OVER, + undefined, + "Should have received exactly one FAILING_OVER notification" + ); + assert.strictEqual( + diagnosticsMap.FAILED_OVER, + undefined, + "Should have received exactly one FAILED_OVER notification" + ); + }); + }); + + describe("Push Notifications Disabled - Server", () => { + beforeEach(async () => { + client = await createTestClient(clientConfig); + + client.on("error", (_err) => { + // Expect the socket to be closed + // Ignore errors + }); + + await client.flushAll(); + }); + + before(async () => { + const { action_id: disablePushNotificationsActionId } = + await faultInjectorClient.triggerAction({ + type: "update_cluster_config", + parameters: { + config: { client_maint_notifications: false }, + }, + }); + + await faultInjectorClient.waitForAction(disablePushNotificationsActionId); + }); + + after(async () => { + const { action_id: enablePushNotificationsActionId } = + await faultInjectorClient.triggerAction({ + type: "update_cluster_config", + parameters: { + config: { client_maint_notifications: true }, + }, + }); + + await faultInjectorClient.waitForAction(enablePushNotificationsActionId); + }); + + it("should NOT receive FAILING_OVER and FAILED_OVER push notifications", async () => { + const notifications: Array = [ + "FAILING_OVER", + "FAILED_OVER", + ]; + + const diagnosticsMap: Record = {}; + + onMessageHandler = createNotificationMessageHandler( + diagnosticsMap, + notifications + ); + + diagnostics_channel.subscribe("redis.maintenance", onMessageHandler); + + const { action_id: failoverActionId } = + await faultInjectorClient.triggerAction({ + type: "failover", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + }); + + await faultInjectorClient.waitForAction(failoverActionId); + + assert.strictEqual( + diagnosticsMap.FAILING_OVER, + undefined, + "Should have received exactly one FAILING_OVER notification" + ); + assert.strictEqual( + diagnosticsMap.FAILED_OVER, + undefined, + "Should have received exactly one FAILED_OVER notification" + ); + }); + }); +}); diff --git a/packages/client/lib/tests/test-scenario/push-notification.e2e.ts b/packages/client/lib/tests/test-scenario/push-notification.e2e.ts index c9c706d4e6..b8c535efd1 100644 --- a/packages/client/lib/tests/test-scenario/push-notification.e2e.ts +++ b/packages/client/lib/tests/test-scenario/push-notification.e2e.ts @@ -112,43 +112,6 @@ describe("Push Notifications", () => { ); }); - it("should receive FAILING_OVER and FAILED_OVER push notifications", async () => { - const notifications: Array = [ - "FAILING_OVER", - "FAILED_OVER", - ]; - - const diagnosticsMap: Record = {}; - - onMessageHandler = createNotificationMessageHandler( - diagnosticsMap, - notifications - ); - - diagnostics_channel.subscribe("redis.maintenance", onMessageHandler); - - const { action_id: failoverActionId } = - await faultInjectorClient.triggerAction({ - type: "failover", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - }); - - await faultInjectorClient.waitForAction(failoverActionId); - - assert.strictEqual( - diagnosticsMap.FAILING_OVER, - 1, - "Should have received exactly one FAILING_OVER notification" - ); - assert.strictEqual( - diagnosticsMap.FAILED_OVER, - 1, - "Should have received exactly one FAILED_OVER notification" - ); - }); }); describe("Push Notifications Disabled - Client", () => { @@ -206,43 +169,6 @@ describe("Push Notifications", () => { ); }); - it("should NOT receive FAILING_OVER and FAILED_OVER push notifications", async () => { - const notifications: Array = [ - "FAILING_OVER", - "FAILED_OVER", - ]; - - const diagnosticsMap: Record = {}; - - onMessageHandler = createNotificationMessageHandler( - diagnosticsMap, - notifications - ); - - diagnostics_channel.subscribe("redis.maintenance", onMessageHandler); - - const { action_id: failoverActionId } = - await faultInjectorClient.triggerAction({ - type: "failover", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - }); - - await faultInjectorClient.waitForAction(failoverActionId); - - assert.strictEqual( - diagnosticsMap.FAILING_OVER, - undefined, - "Should have received exactly one FAILING_OVER notification" - ); - assert.strictEqual( - diagnosticsMap.FAILED_OVER, - undefined, - "Should have received exactly one FAILED_OVER notification" - ); - }); }); describe("Push Notifications Disabled - Server", () => { @@ -322,42 +248,5 @@ describe("Push Notifications", () => { ); }); - it("should NOT receive FAILING_OVER and FAILED_OVER push notifications", async () => { - const notifications: Array = [ - "FAILING_OVER", - "FAILED_OVER", - ]; - - const diagnosticsMap: Record = {}; - - onMessageHandler = createNotificationMessageHandler( - diagnosticsMap, - notifications - ); - - diagnostics_channel.subscribe("redis.maintenance", onMessageHandler); - - const { action_id: failoverActionId } = - await faultInjectorClient.triggerAction({ - type: "failover", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - }); - - await faultInjectorClient.waitForAction(failoverActionId); - - assert.strictEqual( - diagnosticsMap.FAILING_OVER, - undefined, - "Should have received exactly one FAILING_OVER notification" - ); - assert.strictEqual( - diagnosticsMap.FAILED_OVER, - undefined, - "Should have received exactly one FAILED_OVER notification" - ); - }); }); }); diff --git a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts index 37bcb8cbb9..b3781cae15 100644 --- a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts +++ b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts @@ -224,83 +224,4 @@ describe("Timeout Handling During Notifications", () => { "Command Timeout error should be TimeoutError" ); }); - - it("should relax command timeout on FAILING_OVER", async () => { - const notifications: Array = ["FAILING_OVER"]; - - const result: Record< - DiagnosticsEvent["type"], - { error: any; duration: number } - > = {}; - - const onMessageHandler = createNotificationMessageHandler( - client, - result, - notifications - ); - - diagnostics_channel.subscribe("redis.maintenance", onMessageHandler); - - const { action_id: failoverActionId } = - await faultInjectorClient.triggerAction({ - type: "failover", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - }); - - await faultInjectorClient.waitForAction(failoverActionId); - - diagnostics_channel.unsubscribe("redis.maintenance", onMessageHandler); - - notifications.forEach((notification) => { - assert.ok( - result[notification]?.error instanceof Error, - `${notification} notification error should be instanceof Error` - ); - assert.ok( - result[notification]?.duration > RELAXED_COMMAND_TIMEOUT && - result[notification]?.duration < RELAXED_COMMAND_TIMEOUT * 1.1, - `${notification} notification should timeout within relaxed timeout` - ); - assert.strictEqual( - result[notification]?.error?.constructor?.name, - "CommandTimeoutDuringMaintenanceError", - `${notification} notification error should be CommandTimeoutDuringMaintenanceError` - ); - }); - }); - - it("should unrelax command timeout after FAILED_OVER", async () => { - const { action_id: failoverActionId } = - await faultInjectorClient.triggerAction({ - type: "failover", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - }); - - await faultInjectorClient.waitForAction(failoverActionId); - - const { error, duration } = await blockCommand(async () => { - await client.set("key", "value"); - }); - - assert.ok( - error instanceof Error, - "Command Timeout error should be instanceof Error" - ); - assert.ok( - duration > NORMAL_COMMAND_TIMEOUT && - duration < NORMAL_COMMAND_TIMEOUT * 1.1, - `Normal command should timeout within normal timeout ms` - ); - assert.strictEqual( - error?.constructor?.name, - "TimeoutError", - "Command Timeout error should be TimeoutError" - ); - }); }); diff --git a/packages/client/lib/tests/test-scenario/to-failover.e2e.ts b/packages/client/lib/tests/test-scenario/to-failover.e2e.ts new file mode 100644 index 0000000000..666f53e6ee --- /dev/null +++ b/packages/client/lib/tests/test-scenario/to-failover.e2e.ts @@ -0,0 +1,166 @@ +import assert from "node:assert"; + +import { FaultInjectorClient } from "./fault-injector-client"; +import { + getDatabaseConfig, + getDatabaseConfigFromEnv, + getEnvConfig, + RedisConnectionConfig, + blockCommand, + createTestClient, +} from "./test-scenario.util"; +import { createClient } from "../../.."; +import { before } from "mocha"; +import diagnostics_channel from "node:diagnostics_channel"; +import { DiagnosticsEvent } from "../../client/enterprise-maintenance-manager"; + +describe("Timeout Handling During Notifications", () => { + let clientConfig: RedisConnectionConfig; + let faultInjectorClient: FaultInjectorClient; + let client: ReturnType>; + + const NORMAL_COMMAND_TIMEOUT = 50; + const RELAXED_COMMAND_TIMEOUT = 2000; + + /** + * Creates a handler for the `redis.maintenance` channel that will execute and block a command on the client + * when a notification is received and save the result in the `result` object. + * This is used to test that the command timeout is relaxed during notifications. + */ + const createNotificationMessageHandler = ( + client: ReturnType>, + result: Record, + notifications: Array + ) => { + return (message: unknown) => { + if (notifications.includes((message as DiagnosticsEvent).type)) { + setImmediate(async () => { + result[(message as DiagnosticsEvent).type] = await blockCommand( + async () => { + await client.set("key", "value"); + } + ); + }); + } + }; + }; + + before(() => { + const envConfig = getEnvConfig(); + const redisConfig = getDatabaseConfigFromEnv( + envConfig.redisEndpointsConfigPath + ); + + clientConfig = getDatabaseConfig(redisConfig); + faultInjectorClient = new FaultInjectorClient(envConfig.faultInjectorUrl); + }); + + beforeEach(async () => { + client = await createTestClient(clientConfig, { + commandOptions: { timeout: NORMAL_COMMAND_TIMEOUT }, + maintRelaxedCommandTimeout: RELAXED_COMMAND_TIMEOUT, + }); + + await client.flushAll(); + + // Ensure the endpoint is pointing at the correct node before each test + try{ + const { action_id: bindActionId } = await faultInjectorClient.triggerAction( + { + type: "bind", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + } + ); + await faultInjectorClient.waitForAction(bindActionId); + } catch(error) { } + + }); + + afterEach(() => { + if (client && client.isOpen) { + client.destroy(); + } + }); + + it("should relax command timeout on FAILING_OVER", async () => { + const notifications: Array = ["FAILING_OVER"]; + + const result: Record< + DiagnosticsEvent["type"], + { error: any; duration: number } + > = {}; + + const onMessageHandler = createNotificationMessageHandler( + client, + result, + notifications + ); + + diagnostics_channel.subscribe("redis.maintenance", onMessageHandler); + + const { action_id: failoverActionId } = + await faultInjectorClient.triggerAction({ + type: "failover", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + }); + + await faultInjectorClient.waitForAction(failoverActionId); + + diagnostics_channel.unsubscribe("redis.maintenance", onMessageHandler); + + notifications.forEach((notification) => { + assert.ok( + result[notification]?.error instanceof Error, + `${notification} notification error should be instanceof Error` + ); + assert.ok( + result[notification]?.duration > RELAXED_COMMAND_TIMEOUT && + result[notification]?.duration < RELAXED_COMMAND_TIMEOUT * 1.1, + `${notification} notification should timeout within relaxed timeout` + ); + assert.strictEqual( + result[notification]?.error?.constructor?.name, + "CommandTimeoutDuringMaintenanceError", + `${notification} notification error should be CommandTimeoutDuringMaintenanceError` + ); + }); + }); + + it("should unrelax command timeout after FAILED_OVER", async () => { + const { action_id: failoverActionId } = + await faultInjectorClient.triggerAction({ + type: "failover", + parameters: { + bdb_id: clientConfig.bdbId.toString(), + cluster_index: 0, + }, + }); + + await faultInjectorClient.waitForAction(failoverActionId); + + const { error, duration } = await blockCommand(async () => { + await client.set("key", "value"); + }); + + assert.ok( + error instanceof Error, + "Command Timeout error should be instanceof Error" + ); + assert.ok( + duration > NORMAL_COMMAND_TIMEOUT && + duration < NORMAL_COMMAND_TIMEOUT * 1.1, + `Normal command should timeout within normal timeout ms` + ); + assert.strictEqual( + error?.constructor?.name, + "TimeoutError", + "Command Timeout error should be TimeoutError" + ); + }); +}); From 40c9562311429b9f4cc7a5951473966da5c66c38 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Mon, 6 Oct 2025 13:20:34 +0300 Subject: [PATCH 17/18] --wip-- [skip ci] --- .../test-scenario/fault-injector-client.ts | 58 +++++-------------- .../tests/test-scenario/pn-failover.e2e.ts | 14 ----- .../test-scenario/push-notification.e2e.ts | 14 ----- .../timeout-during-notifications.e2e.ts | 15 ----- .../tests/test-scenario/to-failover.e2e.ts | 15 ----- 5 files changed, 13 insertions(+), 103 deletions(-) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index 4c49e1d4cc..fef2626e74 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -57,23 +57,22 @@ export class FaultInjectorClient { } else { console.log(`trigger action: ${action.type}`); } - await this.printStatus(); return this.#request("POST", "/action", action); } - public async printStatus() { - const action = { - type: 'execute_rladmin_command', - parameters: { - rladmin_command: "status", - bdb_id: "1" - } - } - const { action_id } = await this.#request<{action_id: string}>("POST", "/action", action); - const status = await this.waitForAction(action_id); - //@ts-ignore - console.log(status.output.output); - } + // public async printStatus() { + // const action = { + // type: 'execute_rladmin_command', + // parameters: { + // rladmin_command: "status", + // bdb_id: "1" + // } + // } + // const { action_id } = await this.#request<{action_id: string}>("POST", "/action", action); + // const status = await this.waitForAction(action_id); + // //@ts-ignore + // console.log(status.output.output); + // } /** * Gets the status of a specific action. @@ -133,40 +132,9 @@ export class FaultInjectorClient { bdbId: string | number; clusterIndex: string | number; }) { - - const { action_id: migrateActionId } = await this.triggerAction({ - type: "migrate", - parameters: { - cluster_index: clusterIndex, - bdb_id: bdbId.toString(), - }, - }); - - await this.waitForAction(migrateActionId); - - return this.triggerAction( - { - type: "bind", - parameters: { - bdb_id: bdbId.toString(), - cluster_index: clusterIndex, - }, - } - ); - }; - - async migrateAndBindAction1({ - bdbId, - clusterIndex, - }: { - bdbId: string | number; - clusterIndex: string | number; - }) { const bdbIdStr = bdbId.toString(); const clusterIndexStr = clusterIndex.toString(); - await this.printStatus(); - return this.triggerAction<{ action_id: string; }>({ diff --git a/packages/client/lib/tests/test-scenario/pn-failover.e2e.ts b/packages/client/lib/tests/test-scenario/pn-failover.e2e.ts index dbfa037b23..7b977f33a2 100644 --- a/packages/client/lib/tests/test-scenario/pn-failover.e2e.ts +++ b/packages/client/lib/tests/test-scenario/pn-failover.e2e.ts @@ -55,20 +55,6 @@ describe("Push Notifications", () => { client = await createTestClient(clientConfig); await client.flushAll(); - - // Ensure the endpoint is pointing at the correct node before each test - try{ - const { action_id: bindActionId } = await faultInjectorClient.triggerAction( - { - type: "bind", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - } - ); - await faultInjectorClient.waitForAction(bindActionId); - } catch(error) { } }); it("should receive FAILING_OVER and FAILED_OVER push notifications", async () => { diff --git a/packages/client/lib/tests/test-scenario/push-notification.e2e.ts b/packages/client/lib/tests/test-scenario/push-notification.e2e.ts index b8c535efd1..bfaef8351b 100644 --- a/packages/client/lib/tests/test-scenario/push-notification.e2e.ts +++ b/packages/client/lib/tests/test-scenario/push-notification.e2e.ts @@ -55,20 +55,6 @@ describe("Push Notifications", () => { client = await createTestClient(clientConfig); await client.flushAll(); - - // Ensure the endpoint is pointing at the correct node before each test - try{ - const { action_id: bindActionId } = await faultInjectorClient.triggerAction( - { - type: "bind", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - } - ); - await faultInjectorClient.waitForAction(bindActionId); - } catch(error) { } }); it("should receive MOVING, MIGRATING, and MIGRATED push notifications", async () => { diff --git a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts index b3781cae15..30cdd4669c 100644 --- a/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts +++ b/packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts @@ -62,21 +62,6 @@ describe("Timeout Handling During Notifications", () => { }); await client.flushAll(); - - // Ensure the endpoint is pointing at the correct node before each test - try{ - const { action_id: bindActionId } = await faultInjectorClient.triggerAction( - { - type: "bind", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - } - ); - await faultInjectorClient.waitForAction(bindActionId); - } catch(error) { } - }); afterEach(() => { diff --git a/packages/client/lib/tests/test-scenario/to-failover.e2e.ts b/packages/client/lib/tests/test-scenario/to-failover.e2e.ts index 666f53e6ee..506aa6f74b 100644 --- a/packages/client/lib/tests/test-scenario/to-failover.e2e.ts +++ b/packages/client/lib/tests/test-scenario/to-failover.e2e.ts @@ -62,21 +62,6 @@ describe("Timeout Handling During Notifications", () => { }); await client.flushAll(); - - // Ensure the endpoint is pointing at the correct node before each test - try{ - const { action_id: bindActionId } = await faultInjectorClient.triggerAction( - { - type: "bind", - parameters: { - bdb_id: clientConfig.bdbId.toString(), - cluster_index: 0, - }, - } - ); - await faultInjectorClient.waitForAction(bindActionId); - } catch(error) { } - }); afterEach(() => { From 2e25f5f96bd9d73e1a9f3162a7bc823d40a3d589 Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Mon, 6 Oct 2025 13:47:24 +0300 Subject: [PATCH 18/18] --wip-- [skip ci] --- .../lib/tests/test-scenario/fault-injector-client.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/client/lib/tests/test-scenario/fault-injector-client.ts b/packages/client/lib/tests/test-scenario/fault-injector-client.ts index fef2626e74..c03fa1afa1 100644 --- a/packages/client/lib/tests/test-scenario/fault-injector-client.ts +++ b/packages/client/lib/tests/test-scenario/fault-injector-client.ts @@ -48,15 +48,9 @@ export class FaultInjectorClient { * @param action The action request to trigger * @throws {Error} When the HTTP request fails or response cannot be parsed as JSON */ - public async triggerAction( + public triggerAction( action: ActionRequest ): Promise { - if(action.type === 'sequence_of_actions') { - //@ts-ignore - console.log(`trigger sequence: ${action.parameters.actions.map(a => a.type).join(', ')}`); - } else { - console.log(`trigger action: ${action.type}`); - } return this.#request("POST", "/action", action); } @@ -108,14 +102,12 @@ export class FaultInjectorClient { const action = await this.getActionStatus(actionId); if (action.status === "failed") { - console.log(`action ${actionId} failed`); throw new Error( `Action id: ${actionId} failed! Error: ${action.error}` ); } if (["finished", "success"].includes(action.status)) { - console.log(`action ${actionId} complete`); return action; }