diff --git a/redisdb/hatch.toml b/redisdb/hatch.toml index c3a0c2a58420f..e20d8080c944f 100644 --- a/redisdb/hatch.toml +++ b/redisdb/hatch.toml @@ -2,14 +2,17 @@ [[envs.default.matrix]] python = ["3.12"] -version = ["5.0", "6.0", "7.0", "8.0", "cloud"] +version = ["5.0", "6.0", "7.0", "8.0", "cloud", "cluster"] [envs.default.overrides] matrix.version.env-vars = [ { key = "REDIS_VERSION", if = ["5.0", "6.0", "7.0", "8.0"] }, - { key = "CLOUD_ENV", value = "false", if = ["5.0", "6.0", "7.0", "8.0"] }, + { key = "CLOUD_ENV", value = "false", if = ["5.0", "6.0", "7.0", "8.0", "cluster"] }, + { key = "CLUSTER_ENV", value = "false", if = ["5.0", "6.0", "7.0", "8.0", "cloud"] }, { key = "REDIS_VERSION", value="7.0", if = ["cloud"] }, { key = "CLOUD_ENV", value = "true", if = ["cloud"] }, + { key = "REDIS_VERSION", value="7.0", if = ["cluster"] }, + { key = "CLUSTER_ENV", value = "true", if = ["cluster"] }, ] [envs.latest.env-vars] diff --git a/redisdb/tests/common.py b/redisdb/tests/common.py index d0f326eab9aca..2c01b2756f179 100644 --- a/redisdb/tests/common.py +++ b/redisdb/tests/common.py @@ -16,8 +16,11 @@ HOST = get_docker_hostname() REDIS_VERSION = os.getenv('REDIS_VERSION', 'latest') CLOUD_ENV = is_affirmative(os.environ['CLOUD_ENV']) +CLUSTER_ENV = is_affirmative(os.environ['CLUSTER_ENV']) if CLOUD_ENV: DOCKER_COMPOSE_PATH = os.path.join(HERE, 'compose', '1m-2s-cloud.compose') +elif CLUSTER_ENV: + DOCKER_COMPOSE_PATH = os.path.join(HERE, 'compose', '1m-2s-cluster.compose') else: DOCKER_COMPOSE_PATH = os.path.join(HERE, 'compose', '1m-2s.compose') diff --git a/redisdb/tests/compose/1m-2s-cluster.compose b/redisdb/tests/compose/1m-2s-cluster.compose new file mode 100644 index 0000000000000..0af14208d1cb5 --- /dev/null +++ b/redisdb/tests/compose/1m-2s-cluster.compose @@ -0,0 +1,32 @@ +services: + redis-master: + image: "redis:${REDIS_VERSION}" + ports: + - "6382:6382" + networks: + - network1 + command: redis-server /usr/local/etc/redis/redis.conf --port 6382 + volumes: + - ../config/redis.conf:/usr/local/etc/redis/redis.conf + + redis-slave: + image: "redis:${REDIS_VERSION}" + ports: + - "6380:6380" + depends_on: + - "redis-master" + networks: + - network1 + command: redis-server --port 6380 --slaveof redis-master 6382 + + redis-slave-unhealthy: + image: "redis:${REDIS_VERSION}" + ports: + - "6381:6381" + networks: + - network1 + command: redis-server --port 6381 --slaveof redis-master 1234 + +networks: + network1: + name: 1m-2s_default diff --git a/redisdb/tests/config/redis_cluster.conf b/redisdb/tests/config/redis_cluster.conf new file mode 100644 index 0000000000000..57c0d95e837a5 --- /dev/null +++ b/redisdb/tests/config/redis_cluster.conf @@ -0,0 +1,6 @@ +# create a Redis deployment with cluster mode enabled + +cluster-enabled yes +cluster-config-file nodes.conf +cluster-node-timeout 5000 +appendonly yes