anchor.diff:      };
       testScript = ''
         ${initMachine}
  -      $machine->waitForOpenPort(11334);
  -      $machine->log($machine->succeed("cat /etc/rspamd/rspamd.conf"));
  -      $machine->log($machine->succeed("cat /etc/rspamd/rspamd.local.lua"));
  -      $machine->log($machine->succeed("cat /etc/rspamd/local.d/groups.conf"));
  +      machine.wait_for_open_port(11334)
  +      machine.log(machine.succeed("cat /etc/rspamd/rspamd.conf"))
  +      machine.log(machine.succeed("cat /etc/rspamd/rspamd.local.lua"))
  +      machine.log(machine.succeed("cat /etc/rspamd/local.d/groups.conf"))
         # Verify that redis.conf was not written
  -      $machine->fail("cat /etc/rspamd/local.d/redis.conf >&2");
  +      machine.fail("cat /etc/rspamd/local.d/redis.conf >&2")
         # Verify that antivirus.conf was not written
  -      $machine->fail("cat /etc/rspamd/local.d/antivirus.conf >&2");
  +      machine.fail("cat /etc/rspamd/local.d/antivirus.conf >&2")
         ${checkSocket "/run/rspamd/rspamd.sock" "rspamd" "rspamd" "660" }
  -      $machine->log($machine->succeed("curl --unix-socket /run/rspamd/rspamd.sock http://localhost/ping"));
  -      $machine->log($machine->succeed("rspamc -h 127.0.0.1:11334 stat"));
  -      $machine->log($machine->succeed("cat /etc/tests/no-muh.eml | rspamc -h 127.0.0.1:11334"));
  -      $machine->log($machine->succeed("cat /etc/tests/muh.eml | rspamc -h 127.0.0.1:11334 symbols"));
  -      $machine->waitUntilSucceeds("journalctl -u rspamd | grep -i muh >&2");
  -      $machine->log($machine->fail("cat /etc/tests/no-muh.eml | rspamc -h 127.0.0.1:11334 symbols | grep NO_MUH"));
  -      $machine->log($machine->succeed("cat /etc/tests/muh.eml | rspamc -h 127.0.0.1:11334 symbols | grep NO_MUH"));
  +      machine.log(
  +          machine.succeed("curl --unix-socket /run/rspamd/rspamd.sock http://localhost/ping")
  +      )
  +      machine.log(machine.succeed("rspamc -h 127.0.0.1:11334 stat"))
  +      machine.log(machine.succeed("cat /etc/tests/no-muh.eml | rspamc -h 127.0.0.1:11334"))
  +      machine.log(
  +          machine.succeed("cat /etc/tests/muh.eml | rspamc -h 127.0.0.1:11334 symbols")
  +      )
  +      machine.wait_until_succeeds("journalctl -u rspamd | grep -i muh >&2")
  +      machine.log(
  +          machine.fail(
  +              "cat /etc/tests/no-muh.eml | rspamc -h 127.0.0.1:11334 symbols | grep NO_MUH"
  +          )
  +      )
  +      machine.log(
  +          machine.succeed(
  +              "cat /etc/tests/muh.eml | rspamc -h 127.0.0.1:11334 symbols | grep NO_MUH"
  +          )
  +      )
       '';
     };
     postfixIntegration = makeTest {
  
positive.code:   pkgs ? import ../.. { inherit system config; }
  }:
  
  with import ../lib/testing.nix { inherit system pkgs; };
  with pkgs.lib;
  
  let
    initMachine = ''
      startAll
      $machine->waitForUnit("rspamd.service");
      $machine->succeed("id \"rspamd\" >/dev/null");
    '';
    checkSocket = socket: user: group: mode: ''
      $machine->succeed("ls ${socket} >/dev/null");
      $machine->succeed("[[ \"\$(stat -c %U ${socket})\" == \"${user}\" ]]");
      $machine->succeed("[[ \"\$(stat -c %G ${socket})\" == \"${group}\" ]]");
      $machine->succeed("[[ \"\$(stat -c %a ${socket})\" == \"${mode}\" ]]");
    '';
    simple = name: enableIPv6: makeTest {
      name = "rspamd-${name}";
  
negative.code:       networking.enableIPv6 = enableIPv6;
      };
      testScript = ''
        start_all()
        machine.wait_for_unit("multi-user.target")
        machine.wait_for_open_port(11334)
        machine.wait_for_unit("rspamd.service")
        machine.succeed("id rspamd >/dev/null")
        ${checkSocket "/run/rspamd/rspamd.sock" "rspamd" "rspamd" "660" }
        machine.sleep(10)
        machine.log(machine.succeed("cat /etc/rspamd/rspamd.conf"))
        machine.log(
            machine.succeed("grep 'CONFDIR/worker-controller.inc' /etc/rspamd/rspamd.conf")
        )
        machine.log(machine.succeed("grep 'CONFDIR/worker-normal.inc' /etc/rspamd/rspamd.conf"))
        machine.log(machine.succeed("systemctl cat rspamd.service"))
        machine.log(machine.succeed("curl http://localhost:11334/auth"))
        machine.log(machine.succeed("curl http://127.0.0.1:11334/auth"))
        ${optionalString enableIPv6 ''machine.log(machine.succeed("curl http://[::1]:11334/auth"))''}
        # would not reformat
      '';
    };
  in
  