about summary refs log tree commit diff
path: root/nixos/tests/centrifugo.nix
diff options
context:
space:
mode:
authorIvan Trubach <mr.trubach@icloud.com>2024-03-29 15:15:07 +0300
committerIvan Trubach <mr.trubach@icloud.com>2024-03-29 16:38:24 +0300
commitf27f3cdc10c3962e6b5f152cdb78b38db46f71ab (patch)
treee2fedb8916822c4ed7048e13c6a1d4b77004f5ec /nixos/tests/centrifugo.nix
parented8d50fbfc4ef0d559c62d3ee3d40e6067c1524b (diff)
nixos/tests/centrifugo: fix shards address list order in tests
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.
Diffstat (limited to 'nixos/tests/centrifugo.nix')
-rw-r--r--nixos/tests/centrifugo.nix8
1 files changed, 3 insertions, 5 deletions
diff --git a/nixos/tests/centrifugo.nix b/nixos/tests/centrifugo.nix
index 45c2904f5585f..8e940f74caa4b 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;
           };