From f27f3cdc10c3962e6b5f152cdb78b38db46f71ab Mon Sep 17 00:00:00 2001 From: Ivan Trubach Date: Fri, 29 Mar 2024 15:15:07 +0300 Subject: [PATCH] nixos/tests/centrifugo: fix shards address list order in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Redis shards list must be consistent between Centrifugo nodes. Before this change, NixOS tests were using invalid configurtaion since shards[hash(ch)] may select different Redis shard instance on each Centrifugo node. We don’t currently have any tests that exposed this behavior though. --- nixos/tests/centrifugo.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nixos/tests/centrifugo.nix b/nixos/tests/centrifugo.nix index 45c2904f5585..8e940f74caa4 100644 --- a/nixos/tests/centrifugo.nix +++ b/nixos/tests/centrifugo.nix @@ -24,12 +24,10 @@ in engine = "redis"; # Connect to local Redis shard via Unix socket. redis_address = - let - otherNodes = lib.take index nodes ++ lib.drop (index + 1) nodes; - in - map (name: "${name}:${toString redisPort}") otherNodes ++ [ + let toRedisAddresses = map (name: "${name}:${toString redisPort}"); in + toRedisAddresses (lib.take index nodes) ++ [ "unix://${config.services.redis.servers.centrifugo.unixSocket}" - ]; + ] ++ toRedisAddresses (lib.drop (index + 1) nodes); usage_stats_disable = true; api_insecure = true; };