summary refs log blame commit diff
path: root/nixos/tests/novacomd.nix
blob: 4eb60c0feb5ce95cd93857a6bb6e0b59de3f47db (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11





                                            
                      



                                    
                                               
 
                                                                   



                                                               


                                              







                                                                         

                                              


                                    
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");
  '';
})