Skip to content

Commit

Permalink
cluster/services/patroni: adjust test for different numbers of replicas
Browse files Browse the repository at this point in the history
  • Loading branch information
max-privatevoid committed Nov 30, 2024
1 parent f2cbe66 commit ac73a38
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cluster/services/patroni/simulacrum/test.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{ cluster, ... }:
{ cluster, lib, ... }:

let
clusterName = "poseidon";
link = cluster.config.links.patroni-pg-access;
expectedReplicas = (lib.length cluster.config.services.patroni.nodes.worker) - 1;
in
{
defaults = { depot, pkgs, ... }: {
Expand All @@ -26,7 +27,7 @@ in
def booted(nodes):
return filter(lambda node: node.booted, nodes)
def wait_for_all_nodes_ready(expected_replicas=2):
def wait_for_all_nodes_ready(expected_replicas=${toString expectedReplicas}):
booted_nodes = booted(nodes)
for node in booted_nodes:
node.wait_for_unit("patroni.service")
Expand Down Expand Up @@ -71,7 +72,7 @@ in
for node in nodes:
node.crash()
wait_for_all_nodes_ready(1)
wait_for_all_nodes_ready(${toString (expectedReplicas - 1)})
# Execute some queries while a node is down.
run_dummy_queries()
Expand Down

0 comments on commit ac73a38

Please sign in to comment.