* Tests with both a regular client and a cluster client, automatically generating the cluster * configuration from the client configuration. * * Modules, functions, and scripts are placed at the cluster level, while other client options * (password, socket, etc.) are placed under cluster
(
title: string,
fn: (client: RedisClientType<M, F, S, RESP, TYPE_MAPPING> | RedisClusterType<M, F, S, RESP, TYPE_MAPPING/*, POLICIES*/>) => unknown,
clientOptions: ClientTestOptions<M, F, S, RESP, TYPE_MAPPING>
)
| 890 | * @param clientOptions - Client test options (cluster config will be auto-generated) |
| 891 | */ |
| 892 | testAllAuto< |
| 893 | M extends RedisModules = {}, |
| 894 | F extends RedisFunctions = {}, |
| 895 | S extends RedisScripts = {}, |
| 896 | RESP extends RespVersions = 2, |
| 897 | TYPE_MAPPING extends TypeMapping = {} |
| 898 | // POLICIES extends CommandPolicies = {} |
| 899 | >( |
| 900 | title: string, |
| 901 | fn: (client: RedisClientType<M, F, S, RESP, TYPE_MAPPING> | RedisClusterType<M, F, S, RESP, TYPE_MAPPING/*, POLICIES*/>) => unknown, |
| 902 | clientOptions: ClientTestOptions<M, F, S, RESP, TYPE_MAPPING> |
| 903 | ) { |
| 904 | this.testWithClient(`client.${title}`, fn, clientOptions); |
| 905 | |
| 906 | // Auto-generate cluster configuration from client options |
| 907 | const clusterOptions: ClusterTestOptions<M, F, S, RESP, TYPE_MAPPING> = { |
| 908 | serverArguments: clientOptions.serverArguments, |
| 909 | minimumDockerVersion: clientOptions.minimumDockerVersion, |
| 910 | skipTest: clientOptions.skipTest, |
| 911 | clusterConfiguration: {} |
| 912 | }; |
| 913 | |
| 914 | if (clientOptions.clientOptions) { |
| 915 | // eslint-disable-next-line @typescript-eslint/no-explicit-any -- destructure generic test fixtures across M/F/S |
| 916 | const { modules, functions, scripts, ...clientDefaults } = clientOptions.clientOptions as any; |
| 917 | |
| 918 | if (modules) { |
| 919 | clusterOptions.clusterConfiguration!.modules = modules; |
| 920 | } |
| 921 | if (functions) { |
| 922 | clusterOptions.clusterConfiguration!.functions = functions; |
| 923 | } |
| 924 | if (scripts) { |
| 925 | clusterOptions.clusterConfiguration!.scripts = scripts; |
| 926 | } |
| 927 | |
| 928 | // Other client options go under defaults |
| 929 | if (Object.keys(clientDefaults).length > 0) { |
| 930 | clusterOptions.clusterConfiguration!.defaults = clientDefaults; |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | this.testWithCluster(`cluster.${title}`, fn, clusterOptions); |
| 935 | } |
| 936 | |
| 937 | testWithRECluster< |
| 938 | M extends RedisModules = {}, |
nothing calls this directly
no test coverage detected