(
title: string,
fn: (sentinel: RedisSentinelType<M, F, S, RESP, TYPE_MAPPING>) => unknown,
options: SentinelTestOptions<M, F, S, RESP, TYPE_MAPPING>
)
| 616 | }, options); |
| 617 | } |
| 618 | testWithClientSentinel< |
| 619 | M extends RedisModules = {}, |
| 620 | F extends RedisFunctions = {}, |
| 621 | S extends RedisScripts = {}, |
| 622 | RESP extends RespVersions = 2, |
| 623 | TYPE_MAPPING extends TypeMapping = {} |
| 624 | >( |
| 625 | title: string, |
| 626 | fn: (sentinel: RedisSentinelType<M, F, S, RESP, TYPE_MAPPING>) => unknown, |
| 627 | options: SentinelTestOptions<M, F, S, RESP, TYPE_MAPPING> |
| 628 | ): void { |
| 629 | let dockerPromises: ReturnType<typeof spawnRedisSentinel>; |
| 630 | |
| 631 | const passIndex = options.serverArguments.indexOf('--requirepass')+1; |
| 632 | let password: string | undefined = undefined; |
| 633 | if (passIndex != 0) { |
| 634 | password = options.serverArguments[passIndex]; |
| 635 | } |
| 636 | |
| 637 | if (this.isVersionGreaterThan(options.minimumDockerVersion)) { |
| 638 | const dockerImage = this.#DOCKER_IMAGE; |
| 639 | before(function () { |
| 640 | this.timeout(30000); |
| 641 | dockerPromises = spawnRedisSentinel(dockerImage, options.serverArguments); |
| 642 | return dockerPromises; |
| 643 | }); |
| 644 | } |
| 645 | |
| 646 | it(title, async function () { |
| 647 | this.timeout(30000); |
| 648 | if (options.skipTest) return this.skip(); |
| 649 | if (!dockerPromises) return this.skip(); |
| 650 | |
| 651 | |
| 652 | const promises = await dockerPromises; |
| 653 | const rootNodes: Array<RedisNode> = promises.map(promise => ({ |
| 654 | host: "127.0.0.1", |
| 655 | port: promise.port |
| 656 | })); |
| 657 | const { RESP = DEFAULT_RESP, ...sentinelOptions } = options?.sentinelOptions ?? {}; |
| 658 | |
| 659 | |
| 660 | const sentinel = createSentinel({ |
| 661 | name: 'mymaster', |
| 662 | sentinelRootNodes: rootNodes, |
| 663 | RESP, |
| 664 | commandOptions: options.clientOptions?.commandOptions, |
| 665 | nodeClientOptions: { |
| 666 | password: password || undefined, |
| 667 | }, |
| 668 | sentinelClientOptions: { |
| 669 | password: password || undefined, |
| 670 | }, |
| 671 | replicaPoolSize: options?.replicaPoolSize || 0, |
| 672 | scripts: options?.scripts || {}, |
| 673 | modules: options?.modules || {}, |
| 674 | functions: options?.functions || {}, |
| 675 | masterPoolSize: options?.masterPoolSize || undefined, |
no test coverage detected