From 10fa80fd300ce9cd081b578621861332ddf3e411 Mon Sep 17 00:00:00 2001 From: freezeboy Date: Fri, 13 Nov 2020 15:00:34 +0100 Subject: [PATCH] nixos/tests: new test for plikd --- nixos/tests/all-tests.nix | 1 + nixos/tests/plikd.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 nixos/tests/plikd.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 541e0bc0a5c..ab8d79981fb 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -306,6 +306,7 @@ in pinnwand = handleTest ./pinnwand.nix {}; plasma5 = handleTest ./plasma5.nix {}; pleroma = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./pleroma.nix {}; + plikd = handleTest ./plikd.nix {}; plotinus = handleTest ./plotinus.nix {}; podman = handleTestOn ["x86_64-linux"] ./podman.nix {}; postfix = handleTest ./postfix.nix {}; diff --git a/nixos/tests/plikd.nix b/nixos/tests/plikd.nix new file mode 100644 index 00000000000..8fec93c01f6 --- /dev/null +++ b/nixos/tests/plikd.nix @@ -0,0 +1,27 @@ +import ./make-test-python.nix ({ lib, ... }: { + name = "plikd"; + meta = with lib.maintainers; { + maintainers = [ freezeboy ]; + }; + + machine = { pkgs, ... }: let + in { + services.plikd.enable = true; + environment.systemPackages = [ pkgs.plik ]; + }; + + testScript = '' + # Service basic test + machine.wait_for_unit("plikd") + + # Network test + machine.wait_for_open_port("8080") + machine.succeed("curl --fail -v http://localhost:8080") + + # Application test + machine.execute("echo test > /tmp/data.txt") + machine.succeed("plik --server http://localhost:8080 /tmp/data.txt | grep curl") + + machine.succeed("diff data.txt /tmp/data.txt") + ''; +})