python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / nixos / tests / etebase-server.nix
blob49bfccf359e2a10330c9fc32c47b1e6475b832a6
1 import ./make-test-python.nix ({ pkgs, ... }:
3 let
4   dataDir = "/var/lib/foobar";
6 in {
7     name = "etebase-server";
8     meta = with pkgs.lib.maintainers; {
9       maintainers = [ felschr ];
10     };
12     nodes.machine = { pkgs, ... }:
13       {
14         services.etebase-server = {
15           inherit dataDir;
16           enable = true;
17           settings.global.secret_file =
18             toString (pkgs.writeText "secret" "123456");
19         };
20       };
22     testScript = ''
23       machine.wait_for_unit("etebase-server.service")
24       machine.wait_for_open_port(8001)
26       with subtest("Database & src-version were created"):
27           machine.wait_for_file("${dataDir}/src-version")
28           assert (
29               "${pkgs.etebase-server}"
30               in machine.succeed("cat ${dataDir}/src-version")
31           )
32           machine.wait_for_file("${dataDir}/db.sqlite3")
33           machine.wait_for_file("${dataDir}/static")
35       with subtest("Only allow access from allowed_hosts"):
36           machine.succeed("curl -sSfL http://0.0.0.0:8001/")
37           machine.fail("curl -sSfL http://127.0.0.1:8001/")
38           machine.fail("curl -sSfL http://localhost:8001/")
40       with subtest("Run tests"):
41           machine.succeed("etebase-server check")
42           machine.succeed("etebase-server test")
44       with subtest("Create superuser"):
45           machine.succeed(
46               "etebase-server createsuperuser --no-input --username admin --email root@localhost"
47           )
48     '';
49   }