python312Packages.dissect-extfs: 3.11 -> 3.12
[NixPkgs.git] / nixos / tests / magnetico.nix
blobee84aacaf7a74cb97716bd1cde8689dcdad5d5f4
1 import ./make-test-python.nix ({ pkgs, ...} :
3 let
4   port = 8081;
5 in
7   name = "magnetico";
8   meta = with pkgs.lib.maintainers; {
9     maintainers = [ rnhmjoj ];
10   };
12   nodes.machine = { ... }: {
13     imports = [ ../modules/profiles/minimal.nix ];
15     networking.firewall.allowedTCPPorts = [ 9000 ];
17     services.magnetico = {
18       enable = true;
19       crawler.port = 9000;
20       web.port = port;
21       web.credentials.user = "$2y$12$P88ZF6soFthiiAeXnz64aOWDsY3Dw7Yw8fZ6GtiqFNjknD70zDmNe";
22     };
23   };
25   testScript =
26     ''
27       start_all()
28       machine.wait_for_unit("magneticod")
29       machine.wait_for_unit("magneticow")
30       machine.wait_for_open_port(${toString port})
31       machine.succeed(
32           "${pkgs.curl}/bin/curl --fail "
33           + "-u user:password http://localhost:${toString port}"
34       )
35       machine.fail(
36           "${pkgs.curl}/bin/curl --fail "
37           + "-u user:wrongpwd http://localhost:${toString port}"
38       )
39       machine.shutdown()
40     '';