nixos/tests/etebase-server: init
This commit is contained in:
parent
410d181739
commit
0f92c208bb
2 changed files with 51 additions and 0 deletions
|
@ -110,6 +110,7 @@ in
|
|||
ergo = handleTest ./ergo.nix {};
|
||||
etcd = handleTestOn ["x86_64-linux"] ./etcd.nix {};
|
||||
etcd-cluster = handleTestOn ["x86_64-linux"] ./etcd-cluster.nix {};
|
||||
etebase-server = handleTest ./etebase-server.nix {};
|
||||
etesync-dav = handleTest ./etesync-dav.nix {};
|
||||
fancontrol = handleTest ./fancontrol.nix {};
|
||||
fcitx = handleTest ./fcitx {};
|
||||
|
|
50
nixos/tests/etebase-server.nix
Normal file
50
nixos/tests/etebase-server.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
import ./make-test-python.nix ({ pkgs, ... }:
|
||||
|
||||
let
|
||||
dataDir = "/var/lib/foobar";
|
||||
|
||||
in {
|
||||
name = "etebase-server";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ felschr ];
|
||||
};
|
||||
|
||||
machine = { pkgs, ... }:
|
||||
{
|
||||
services.etebase-server = {
|
||||
inherit dataDir;
|
||||
enable = true;
|
||||
settings.global.secret_file =
|
||||
toString (pkgs.writeText "secret" "123456");
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("etebase-server.service")
|
||||
machine.wait_for_open_port(8001)
|
||||
|
||||
with subtest("Database & src-version were created"):
|
||||
machine.wait_for_file("${dataDir}/src-version")
|
||||
assert (
|
||||
"${pkgs.etebase-server}"
|
||||
in machine.succeed("cat ${dataDir}/src-version")
|
||||
)
|
||||
machine.wait_for_file("${dataDir}/db.sqlite3")
|
||||
machine.wait_for_file("${dataDir}/static")
|
||||
|
||||
with subtest("Only allow access from allowed_hosts"):
|
||||
machine.succeed("curl -sSfL http://0.0.0.0:8001/")
|
||||
machine.fail("curl -sSfL http://127.0.0.1:8001/")
|
||||
machine.fail("curl -sSfL http://localhost:8001/")
|
||||
|
||||
with subtest("Run tests"):
|
||||
machine.succeed("etebase-server check")
|
||||
machine.succeed("etebase-server test")
|
||||
|
||||
with subtest("Create superuser"):
|
||||
machine.succeed(
|
||||
"etebase-server createsuperuser --no-input --username admin --email root@localhost"
|
||||
)
|
||||
'';
|
||||
}
|
||||
)
|
Loading…
Reference in a new issue