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.
This commit is contained in:
Ivan Trubach 2024-03-29 15:15:07 +03:00
parent ed8d50fbfc
commit f27f3cdc10

View File

@ -24,12 +24,10 @@ in
engine = "redis"; engine = "redis";
# Connect to local Redis shard via Unix socket. # Connect to local Redis shard via Unix socket.
redis_address = redis_address =
let let toRedisAddresses = map (name: "${name}:${toString redisPort}"); in
otherNodes = lib.take index nodes ++ lib.drop (index + 1) nodes; toRedisAddresses (lib.take index nodes) ++ [
in
map (name: "${name}:${toString redisPort}") otherNodes ++ [
"unix://${config.services.redis.servers.centrifugo.unixSocket}" "unix://${config.services.redis.servers.centrifugo.unixSocket}"
]; ] ++ toRedisAddresses (lib.drop (index + 1) nodes);
usage_stats_disable = true; usage_stats_disable = true;
api_insecure = true; api_insecure = true;
}; };