summary refs log tree commit diff
path: root/nixos/tests/novacomd.nix
blob: 4eb60c0feb5ce95cd93857a6bb6e0b59de3f47db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import ./make-test.nix ({ pkgs, ...} : {
  name = "novacomd";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ dtzWill ];
  };

  machine = { ... }: {
    services.novacomd.enable = true;
  };

  testScript = ''
    $machine->waitForUnit("multi-user.target");

    # multi-user.target wants novacomd.service, but let's make sure
    $machine->waitForUnit("novacomd.service");

    # Check status and try connecting with novacom
    $machine->succeed("systemctl status novacomd.service >&2");
    # to prevent non-deterministic failure,
    # make sure the daemon is really listening
    $machine->waitForOpenPort(6968);
    $machine->succeed("novacom -l");

    # Stop the daemon, double-check novacom fails if daemon isn't working
    $machine->stopJob("novacomd");
    $machine->fail("novacom -l");

    # And back again for good measure
    $machine->startJob("novacomd");
    # make sure the daemon is really listening
    $machine->waitForOpenPort(6968);
    $machine->succeed("novacom -l");
  '';
})