nixosTests.novacomd: Port tests to python

This commit is contained in:
Christian Kampka 2019-12-15 19:32:34 +01:00
parent 065770607e
commit 1f3f9fd3a2
No known key found for this signature in database
GPG Key ID: B88E140DB4FE1AA5

View File

@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : { import ./make-test-python.nix ({ pkgs, ...} : {
name = "novacomd"; name = "novacomd";
meta = with pkgs.stdenv.lib.maintainers; { meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ dtzWill ]; maintainers = [ dtzWill ];
@ -9,26 +9,20 @@ import ./make-test.nix ({ pkgs, ...} : {
}; };
testScript = '' testScript = ''
$machine->waitForUnit("multi-user.target"); machine.wait_for_unit("novacomd.service")
# multi-user.target wants novacomd.service, but let's make sure with subtest("Make sure the daemon is really listening"):
$machine->waitForUnit("novacomd.service"); machine.wait_for_open_port(6968)
machine.succeed("novacom -l")
# Check status and try connecting with novacom with subtest("Stop the daemon, double-check novacom fails if daemon isn't working"):
$machine->succeed("systemctl status novacomd.service >&2"); machine.stop_job("novacomd")
# to prevent non-deterministic failure, machine.fail("novacom -l")
# 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 with subtest("Make sure the daemon starts back up again"):
$machine->stopJob("novacomd"); machine.start_job("novacomd")
$machine->fail("novacom -l"); # make sure the daemon is really listening
machine.wait_for_open_port(6968)
# And back again for good measure machine.succeed("novacom -l")
$machine->startJob("novacomd");
# make sure the daemon is really listening
$machine->waitForOpenPort(6968);
$machine->succeed("novacom -l");
''; '';
}) })