1 import ./make-test-python.nix ({ pkgs, lib, ... }: {
3 meta.maintainers = [ lib.maintainers.raitobezarius ];
6 node1 = { pkgs, ... }: {
7 services.keepalived.enable = true;
8 services.keepalived.openFirewall = true;
9 services.keepalived.vrrpInstances.test = {
13 virtualIps = [{ addr = "192.168.1.200"; }];
16 environment.systemPackages = [ pkgs.tcpdump ];
18 node2 = { pkgs, ... }: {
19 services.keepalived.enable = true;
20 services.keepalived.openFirewall = true;
21 services.keepalived.vrrpInstances.test = {
25 virtualIps = [{ addr = "192.168.1.200"; }];
28 environment.systemPackages = [ pkgs.tcpdump ];
33 # wait for boot time delay to pass
34 for node in [node1, node2]:
35 node.wait_until_succeeds(
36 "systemctl show -p LastTriggerUSecMonotonic keepalived-boot-delay.timer | grep -vq 'LastTriggerUSecMonotonic=0'"
38 node.wait_for_unit("keepalived")
39 node2.wait_until_succeeds("ip addr show dev eth1 | grep -q 192.168.1.200")
40 node1.fail("ip addr show dev eth1 | grep -q 192.168.1.200")
41 node1.succeed("ping -c1 192.168.1.200")