From b1924a69eabc8e1300e2bb371d6e16177126e9e3 Mon Sep 17 00:00:00 2001 From: Shoham Elias <116083498+shohamazon@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:32:59 +0300 Subject: [PATCH] Node: Rename RedisClient, RedisClusterClient to GlideClient, GlideClusterClient (#1670) --- CHANGELOG.md | 1 + benchmarks/node/node_benchmark.ts | 18 ++++----- examples/node/index.ts | 12 +++--- node/README.md | 8 ++-- node/index.ts | 4 +- node/npm/glide/index.ts | 12 +++--- node/src/{RedisClient.ts => GlideClient.ts} | 18 ++++----- ...ClusterClient.ts => GlideClusterClient.ts} | 10 ++--- node/src/Transaction.ts | 6 +-- node/tests/RedisClient.test.ts | 26 ++++++------- node/tests/RedisClientInternals.test.ts | 26 ++++++------- node/tests/RedisClusterClient.test.ts | 38 +++++++++---------- node/tests/SharedTests.ts | 10 ++--- node/tests/TestUtilities.ts | 8 ++-- 14 files changed, 99 insertions(+), 98 deletions(-) rename node/src/{RedisClient.ts => GlideClient.ts} (96%) rename node/src/{RedisClusterClient.ts => GlideClusterClient.ts} (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc3fbc3780..14518ac252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ ### Breaking Changes * Node: Update XREAD to return a Map of Map ([#1494](https://github.com/aws/glide-for-redis/pull/1494)) +* Node: Rename RedisClient to GlideClient and RedisClusterClient to GlideClusterClient ([#1670](https://github.com/aws/glide-for-redis/pull/1670)) ## 0.4.1 (2024-02-06) diff --git a/benchmarks/node/node_benchmark.ts b/benchmarks/node/node_benchmark.ts index e269613620..1f5b70703f 100644 --- a/benchmarks/node/node_benchmark.ts +++ b/benchmarks/node/node_benchmark.ts @@ -3,7 +3,7 @@ */ import { writeFileSync } from "fs"; -import { Logger, RedisClient, RedisClusterClient } from "glide-for-redis"; +import { GlideClient, GlideClusterClient, Logger } from "glide-for-redis"; import { Cluster, Redis } from "ioredis"; import { parse } from "path"; import percentile from "percentile"; @@ -216,8 +216,8 @@ async function main( if (clientsToRun == "all" || clientsToRun == "glide") { const clientClass = clusterModeEnabled - ? RedisClusterClient - : RedisClient; + ? GlideClusterClient + : GlideClient; const clients = await createClients(clientCount, () => clientClass.createClient({ addresses: [{ host, port }], @@ -232,7 +232,7 @@ async function main( dataSize, data, (client) => { - (client as RedisClient).close(); + (client as GlideClient).close(); }, clusterModeEnabled, ); @@ -240,11 +240,11 @@ async function main( } if (clientsToRun == "all") { - const nodeRedisClients = await createClients(clientCount, async () => { + const nodeGlideClients = await createClients(clientCount, async () => { const node = { url: getAddress(host, useTLS, port), }; - const nodeRedisClient = clusterModeEnabled + const nodeGlideClient = clusterModeEnabled ? createCluster({ rootNodes: [{ socket: { host, port, tls: useTLS } }], defaults: { @@ -255,11 +255,11 @@ async function main( useReplicas: true, }) : createClient(node); - await nodeRedisClient.connect(); - return nodeRedisClient; + await nodeGlideClient.connect(); + return nodeGlideClient; }); await runClients( - nodeRedisClients, + nodeGlideClients, "node_redis", totalCommands, numOfConcurrentTasks, diff --git a/examples/node/index.ts b/examples/node/index.ts index a83b5dfa74..ec7533f547 100644 --- a/examples/node/index.ts +++ b/examples/node/index.ts @@ -2,7 +2,7 @@ * Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ -import { Logger, RedisClient, RedisClusterClient } from "@aws/glide-for-redis"; +import { GlideClient, GlideClusterClient, Logger } from "@aws/glide-for-redis"; async function sendPingToNode() { // When in Redis is in standalone mode, add address of the primary node, and any replicas you'd like to be able to read from. @@ -12,8 +12,8 @@ async function sendPingToNode() { port: 6379, }, ]; - // Check `RedisClientConfiguration/ClusterClientConfiguration` for additional options. - const client = await RedisClient.createClient({ + // Check `GlideClientConfiguration/ClusterClientConfiguration` for additional options. + const client = await GlideClient.createClient({ addresses: addresses, // if the server uses TLS, you'll need to enable it. Otherwise the connection attempt will time out silently. // useTLS: true, @@ -26,7 +26,7 @@ async function sendPingToNode() { client.close(); } -async function send_set_and_get(client: RedisClient | RedisClusterClient) { +async function send_set_and_get(client: GlideClient | GlideClusterClient) { const set_response = await client.set("foo", "bar"); console.log(`Set response is = ${set_response}`); const get_response = await client.get("foo"); @@ -41,8 +41,8 @@ async function sendPingToRandomNodeInCluster() { port: 6380, }, ]; - // Check `RedisClientConfiguration/ClusterClientConfiguration` for additional options. - const client = await RedisClusterClient.createClient({ + // Check `GlideClientConfiguration/ClusterClientConfiguration` for additional options. + const client = await GlideClusterClient.createClient({ addresses: addresses, // if the cluster nodes use TLS, you'll need to enable it. Otherwise the connection attempt will time out silently. // useTLS: true, diff --git a/node/README.md b/node/README.md index 68c8331411..ae5fcaf292 100644 --- a/node/README.md +++ b/node/README.md @@ -45,7 +45,7 @@ To install GLIDE for Redis using `npm`, follow these steps: #### Cluster Redis: ```node -import { RedisClusterClient } from "@aws/glide-for-redis"; +import { GlideClusterClient } from "@aws/glide-for-redis"; const addresses = [ { @@ -53,7 +53,7 @@ const addresses = [ port: 6379, }, ]; -const client = await RedisClusterClient.createClient({ +const client = await GlideClusterClient.createClient({ addresses: addresses, }); await client.set("foo", "bar"); @@ -64,7 +64,7 @@ client.close(); #### Standalone Redis: ```node -import { RedisClient } from "@aws/glide-for-redis"; +import { GlideClient } from "@aws/glide-for-redis"; const addresses = [ { @@ -76,7 +76,7 @@ const addresses = [ port: 6379, }, ]; -const client = await RedisClient.createClient({ +const client = await GlideClient.createClient({ addresses: addresses, }); await client.set("foo", "bar"); diff --git a/node/index.ts b/node/index.ts index 1d0490ae5d..e2bac6f555 100644 --- a/node/index.ts +++ b/node/index.ts @@ -6,7 +6,7 @@ export { Script } from "glide-rs"; export * from "./src/BaseClient"; export * from "./src/Commands"; export * from "./src/Errors"; +export * from "./src/GlideClient"; +export * from "./src/GlideClusterClient"; export * from "./src/Logger"; -export * from "./src/RedisClient"; -export * from "./src/RedisClusterClient"; export * from "./src/Transaction"; diff --git a/node/npm/glide/index.ts b/node/npm/glide/index.ts index f58f45b3e5..c0c5b827f1 100644 --- a/node/npm/glide/index.ts +++ b/node/npm/glide/index.ts @@ -74,9 +74,9 @@ function loadNativeBinding() { function initialize() { const nativeBinding = loadNativeBinding(); const { - RedisClient, - RedisClusterClient, - RedisClientConfiguration, + GlideClient, + GlideClusterClient, + GlideClientConfiguration, SlotIdTypes, SlotKeyTypes, RouteByAddress, @@ -117,9 +117,9 @@ function initialize() { } = nativeBinding; module.exports = { - RedisClient, - RedisClusterClient, - RedisClientConfiguration, + GlideClient, + GlideClusterClient, + GlideClientConfiguration, SlotIdTypes, SlotKeyTypes, RouteByAddress, diff --git a/node/src/RedisClient.ts b/node/src/GlideClient.ts similarity index 96% rename from node/src/RedisClient.ts rename to node/src/GlideClient.ts index 6df3c8ebfa..822aaafdae 100644 --- a/node/src/RedisClient.ts +++ b/node/src/GlideClient.ts @@ -22,7 +22,7 @@ import { import { connection_request } from "./ProtobufMessage"; import { Transaction } from "./Transaction"; -export type RedisClientConfiguration = BaseClientConfiguration & { +export type GlideClientConfiguration = BaseClientConfiguration & { /** * index of the logical database to connect to. */ @@ -59,12 +59,12 @@ export type RedisClientConfiguration = BaseClientConfiguration & { * For full documentation, see * https://github.com/aws/babushka/wiki/NodeJS-wrapper#redis-standalone */ -export class RedisClient extends BaseClient { +export class GlideClient extends BaseClient { /** * @internal */ protected createClientRequest( - options: RedisClientConfiguration, + options: GlideClientConfiguration, ): connection_request.IConnectionRequest { const configuration = super.createClientRequest(options); configuration.databaseId = options.databaseId; @@ -73,22 +73,22 @@ export class RedisClient extends BaseClient { } public static createClient( - options: RedisClientConfiguration, - ): Promise { - return super.createClientInternal( + options: GlideClientConfiguration, + ): Promise { + return super.createClientInternal( options, - (socket: net.Socket) => new RedisClient(socket), + (socket: net.Socket) => new GlideClient(socket), ); } static async __createClient( options: BaseClientConfiguration, connectedSocket: net.Socket, - ): Promise { + ): Promise { return this.__createClientInternal( options, connectedSocket, - (socket, options) => new RedisClient(socket, options), + (socket, options) => new GlideClient(socket, options), ); } diff --git a/node/src/RedisClusterClient.ts b/node/src/GlideClusterClient.ts similarity index 98% rename from node/src/RedisClusterClient.ts rename to node/src/GlideClusterClient.ts index b6b688dc32..527f1bf672 100644 --- a/node/src/RedisClusterClient.ts +++ b/node/src/GlideClusterClient.ts @@ -204,7 +204,7 @@ function toProtobufRoute( * For full documentation, see * https://github.com/aws/babushka/wiki/NodeJS-wrapper#redis-cluster */ -export class RedisClusterClient extends BaseClient { +export class GlideClusterClient extends BaseClient { /** * @internal */ @@ -235,22 +235,22 @@ export class RedisClusterClient extends BaseClient { public static async createClient( options: ClusterClientConfiguration, - ): Promise { + ): Promise { return await super.createClientInternal( options, (socket: net.Socket, options?: ClusterClientConfiguration) => - new RedisClusterClient(socket, options), + new GlideClusterClient(socket, options), ); } static async __createClient( options: BaseClientConfiguration, connectedSocket: net.Socket, - ): Promise { + ): Promise { return super.__createClientInternal( options, connectedSocket, - (socket, options) => new RedisClusterClient(socket, options), + (socket, options) => new GlideClusterClient(socket, options), ); } diff --git a/node/src/Transaction.ts b/node/src/Transaction.ts index 7024ff8463..8e14d3dd62 100644 --- a/node/src/Transaction.ts +++ b/node/src/Transaction.ts @@ -1529,7 +1529,7 @@ export class BaseTransaction> { * Transactions allow the execution of a group of commands in a single step. * * Command Response: - * An array of command responses is returned by the RedisClient.exec command, in the order they were given. + * An array of command responses is returned by the GlideClient.exec command, in the order they were given. * Each element in the array represents a command given to the transaction. * The response for each command depends on the executed Redis command. * Specific response types are documented alongside each method. @@ -1540,7 +1540,7 @@ export class BaseTransaction> { * .set("key", "value") * .select(1) /// Standalone command * .get("key"); - * const result = await redisClient.exec(transaction); + * const result = await GlideClient.exec(transaction); * console.log(result); // Output: ['OK', 'OK', null] * ``` */ @@ -1564,7 +1564,7 @@ export class Transaction extends BaseTransaction { * Transactions allow the execution of a group of commands in a single step. * * Command Response: - * An array of command responses is returned by the RedisClusterClient.exec command, in the order they were given. + * An array of command responses is returned by the GlideClusterClient.exec command, in the order they were given. * Each element in the array represents a command given to the transaction. * The response for each command depends on the executed Redis command. * Specific response types are documented alongside each method. diff --git a/node/tests/RedisClient.test.ts b/node/tests/RedisClient.test.ts index cdb248a9b2..0ec781ab17 100644 --- a/node/tests/RedisClient.test.ts +++ b/node/tests/RedisClient.test.ts @@ -12,7 +12,7 @@ import { } from "@jest/globals"; import { BufferReader, BufferWriter } from "protobufjs"; import { v4 as uuidv4 } from "uuid"; -import { ProtocolVersion, RedisClient, Transaction } from ".."; +import { GlideClient, ProtocolVersion, Transaction } from ".."; import { RedisCluster } from "../../utils/TestUtils.js"; import { redis_request } from "../src/ProtobufMessage"; import { runBaseTests } from "./SharedTests"; @@ -30,15 +30,15 @@ import { /* eslint-disable @typescript-eslint/no-var-requires */ type Context = { - client: RedisClient; + client: GlideClient; }; const TIMEOUT = 50000; -describe("RedisClient", () => { +describe("GlideClient", () => { let testsFailed = 0; let cluster: RedisCluster; - let client: RedisClient; + let client: GlideClient; beforeAll(async () => { const standaloneAddresses = parseCommandLineArgs()["standalone-endpoints"]; @@ -106,7 +106,7 @@ describe("RedisClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "info without parameters", async (protocol) => { - client = await RedisClient.createClient( + client = await GlideClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const result = await client.info(); @@ -125,7 +125,7 @@ describe("RedisClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "simple select test", async (protocol) => { - client = await RedisClient.createClient( + client = await GlideClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); let selectResult = await client.select(0); @@ -149,7 +149,7 @@ describe("RedisClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `can send transactions_%p`, async (protocol) => { - client = await RedisClient.createClient( + client = await GlideClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const transaction = new Transaction(); @@ -164,10 +164,10 @@ describe("RedisClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "can return null on WATCH transaction failures", async (protocol) => { - const client1 = await RedisClient.createClient( + const client1 = await GlideClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); - const client2 = await RedisClient.createClient( + const client2 = await GlideClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const transaction = new Transaction(); @@ -189,7 +189,7 @@ describe("RedisClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "object freq transaction test_%p", async (protocol) => { - const client = await RedisClient.createClient( + const client = await GlideClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); @@ -230,7 +230,7 @@ describe("RedisClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "object idletime transaction test_%p", async (protocol) => { - const client = await RedisClient.createClient( + const client = await GlideClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); @@ -275,7 +275,7 @@ describe("RedisClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "object refcount transaction test_%p", async (protocol) => { - const client = await RedisClient.createClient( + const client = await GlideClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); @@ -306,7 +306,7 @@ describe("RedisClient", () => { options.protocol = protocol; options.clientName = clientName; testsFailed += 1; - client = await RedisClient.createClient(options); + client = await GlideClient.createClient(options); return { client, context: { client } }; }, close: (context: Context, testSucceeded: boolean) => { diff --git a/node/tests/RedisClientInternals.test.ts b/node/tests/RedisClientInternals.test.ts index 2ea1e08fc3..c910b3bb1d 100644 --- a/node/tests/RedisClientInternals.test.ts +++ b/node/tests/RedisClientInternals.test.ts @@ -22,11 +22,11 @@ import { BaseClientConfiguration, ClosingError, ClusterClientConfiguration, + GlideClient, + GlideClientConfiguration, + GlideClusterClient, InfoOptions, Logger, - RedisClient, - RedisClientConfiguration, - RedisClusterClient, RequestError, ReturnType, SlotKeyTypes, @@ -124,11 +124,11 @@ function sendResponse( function getConnectionAndSocket( checkRequest?: (request: connection_request.ConnectionRequest) => boolean, - connectionOptions?: ClusterClientConfiguration | RedisClientConfiguration, + connectionOptions?: ClusterClientConfiguration | GlideClientConfiguration, isCluster?: boolean, ): Promise<{ socket: net.Socket; - connection: RedisClient | RedisClusterClient; + connection: GlideClient | GlideClusterClient; server: net.Server; }> { return new Promise((resolve, reject) => { @@ -136,7 +136,7 @@ function getConnectionAndSocket( path.join(os.tmpdir(), `socket_listener`), ); const socketName = path.join(temporaryFolder, "read"); - let connectionPromise: Promise; // eslint-disable-line prefer-const + let connectionPromise: Promise; // eslint-disable-line prefer-const const server = net .createServer(async (socket) => { socket.once("data", (data) => { @@ -174,8 +174,8 @@ function getConnectionAndSocket( addresses: [{ host: "foo" }], }; const connection = isCluster - ? await RedisClusterClient.__createClient(options, socket) - : await RedisClient.__createClient(options, socket); + ? await GlideClusterClient.__createClient(options, socket) + : await GlideClient.__createClient(options, socket); resolve(connection); }); @@ -184,7 +184,7 @@ function getConnectionAndSocket( } function closeTestResources( - connection: RedisClient | RedisClusterClient, + connection: GlideClient | GlideClusterClient, server: net.Server, socket: net.Socket, ) { @@ -195,7 +195,7 @@ function closeTestResources( async function testWithResources( testFunction: ( - connection: RedisClient | RedisClusterClient, + connection: GlideClient | GlideClusterClient, socket: net.Socket, ) => Promise, connectionOptions?: BaseClientConfiguration, @@ -212,7 +212,7 @@ async function testWithResources( async function testWithClusterResources( testFunction: ( - connection: RedisClusterClient, + connection: GlideClusterClient, socket: net.Socket, ) => Promise, connectionOptions?: BaseClientConfiguration, @@ -224,7 +224,7 @@ async function testWithClusterResources( ); try { - if (connection instanceof RedisClusterClient) { + if (connection instanceof GlideClusterClient) { await testFunction(connection, socket); } else { throw new Error("Not cluster connection"); @@ -235,7 +235,7 @@ async function testWithClusterResources( } async function testSentValueMatches(config: { - sendRequest: (client: RedisClient | RedisClusterClient) => Promise; + sendRequest: (client: GlideClient | GlideClusterClient) => Promise; expectedRequestType: redis_request.RequestType | null | undefined; expectedValue: unknown; }) { diff --git a/node/tests/RedisClusterClient.test.ts b/node/tests/RedisClusterClient.test.ts index 050b9b1459..c627a8f9bd 100644 --- a/node/tests/RedisClusterClient.test.ts +++ b/node/tests/RedisClusterClient.test.ts @@ -14,9 +14,9 @@ import { v4 as uuidv4 } from "uuid"; import { ClusterTransaction, + GlideClusterClient, InfoOptions, ProtocolVersion, - RedisClusterClient, } from ".."; import { RedisCluster } from "../../utils/TestUtils.js"; import { checkIfServerVersionLessThan, runBaseTests } from "./SharedTests"; @@ -31,15 +31,15 @@ import { transactionTest, } from "./TestUtilities"; type Context = { - client: RedisClusterClient; + client: GlideClusterClient; }; const TIMEOUT = 50000; -describe("RedisClusterClient", () => { +describe("GlideClusterClient", () => { let testsFailed = 0; let cluster: RedisCluster; - let client: RedisClusterClient; + let client: GlideClusterClient; beforeAll(async () => { const clusterAddresses = parseCommandLineArgs()["cluster-endpoints"]; // Connect to cluster or create a new one based on the parsed addresses @@ -69,7 +69,7 @@ describe("RedisClusterClient", () => { options.protocol = protocol; options.clientName = clientName; testsFailed += 1; - client = await RedisClusterClient.createClient(options); + client = await GlideClusterClient.createClient(options); return { context: { client, @@ -88,7 +88,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `info with server and replication_%p`, async (protocol) => { - client = await RedisClusterClient.createClient( + client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const info_server = getFirstResult( @@ -115,7 +115,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `info with server and randomNode route_%p`, async (protocol) => { - client = await RedisClusterClient.createClient( + client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const result = await client.info( @@ -145,7 +145,7 @@ describe("RedisClusterClient", () => { ); }; - client = await RedisClusterClient.createClient( + client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const result = cleanResult( @@ -196,7 +196,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `fail routing by address if no port is provided_%p`, async (protocol) => { - client = await RedisClusterClient.createClient( + client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); expect(() => @@ -212,7 +212,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `config get and config set transactions test_%p`, async (protocol) => { - client = await RedisClusterClient.createClient( + client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const transaction = new ClusterTransaction(); @@ -229,7 +229,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `can send transactions_%p`, async (protocol) => { - client = await RedisClusterClient.createClient( + client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const transaction = new ClusterTransaction(); @@ -243,10 +243,10 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `can return null on WATCH transaction failures_%p`, async (protocol) => { - const client1 = await RedisClusterClient.createClient( + const client1 = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); - const client2 = await RedisClusterClient.createClient( + const client2 = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const transaction = new ClusterTransaction(); @@ -269,7 +269,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `echo with all nodes routing_%p`, async (protocol) => { - client = await RedisClusterClient.createClient( + client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); const message = uuidv4(); @@ -286,7 +286,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `check that multi key command returns a cross slot error`, async (protocol) => { - const client = await RedisClusterClient.createClient( + const client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); @@ -327,7 +327,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( `check that multi key command routed to multiple nodes`, async (protocol) => { - const client = await RedisClusterClient.createClient( + const client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); @@ -344,7 +344,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "object freq transaction test_%p", async (protocol) => { - const client = await RedisClusterClient.createClient( + const client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); @@ -385,7 +385,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "object idletime transaction test_%p", async (protocol) => { - const client = await RedisClusterClient.createClient( + const client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); @@ -430,7 +430,7 @@ describe("RedisClusterClient", () => { it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])( "object refcount transaction test_%p", async (protocol) => { - const client = await RedisClusterClient.createClient( + const client = await GlideClusterClient.createClient( getClientConfigurationOption(cluster.getAddresses(), protocol), ); diff --git a/node/tests/SharedTests.ts b/node/tests/SharedTests.ts index 9d40a8b6df..dbcdc7840a 100644 --- a/node/tests/SharedTests.ts +++ b/node/tests/SharedTests.ts @@ -8,11 +8,11 @@ import { v4 as uuidv4 } from "uuid"; import { ClosingError, ExpireOptions, + GlideClient, + GlideClusterClient, InfoOptions, InsertPosition, ProtocolVersion, - RedisClient, - RedisClusterClient, Script, parseInfoResponse, } from "../"; @@ -59,7 +59,7 @@ export async function checkIfServerVersionLessThan( return versionToCompare < minVersion; } -export type BaseClient = RedisClient | RedisClusterClient; +export type BaseClient = GlideClient | GlideClusterClient; export function runBaseTests(config: { init: ( @@ -2473,7 +2473,7 @@ export function runBaseTests(config: { await expect(client.brpop(["foo"], 0.1)).rejects.toThrow(); // Same-slot requirement - if (client instanceof RedisClusterClient) { + if (client instanceof GlideClusterClient) { try { expect( await client.brpop(["abc", "zxy", "lkn"], 0.1), @@ -2510,7 +2510,7 @@ export function runBaseTests(config: { await expect(client.blpop(["foo"], 0.1)).rejects.toThrow(); // Same-slot requirement - if (client instanceof RedisClusterClient) { + if (client instanceof GlideClusterClient) { try { expect( await client.blpop(["abc", "zxy", "lkn"], 0.1), diff --git a/node/tests/TestUtilities.ts b/node/tests/TestUtilities.ts index 7fdd5c2070..5a78091df0 100644 --- a/node/tests/TestUtilities.ts +++ b/node/tests/TestUtilities.ts @@ -10,11 +10,11 @@ import { BaseClient, BaseClientConfiguration, ClusterTransaction, + GlideClient, + GlideClusterClient, InsertPosition, Logger, ProtocolVersion, - RedisClient, - RedisClusterClient, ReturnType, Transaction, } from ".."; @@ -218,8 +218,8 @@ export async function testTeardown( option: BaseClientConfiguration, ) { const client = cluster_mode - ? await RedisClusterClient.createClient(option) - : await RedisClient.createClient(option); + ? await GlideClusterClient.createClient(option) + : await GlideClient.createClient(option); await client.customCommand(["FLUSHALL"]); client.close();