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