1import ./make-test-python.nix ({ pkgs, ...} :
2
3let
4 port = 8081;
5in
6{
7 name = "magnetico";
8 meta = with pkgs.lib.maintainers; {
9 maintainers = [ rnhmjoj ];
10 };
11
12 nodes.machine = { ... }: {
13 imports = [ ../modules/profiles/minimal.nix ];
14
15 networking.firewall.allowedTCPPorts = [ 9000 ];
16
17 services.magnetico = {
18 enable = true;
19 crawler.port = 9000;
20 web.port = port;
21 web.credentials.user = "$2y$12$P88ZF6soFthiiAeXnz64aOWDsY3Dw7Yw8fZ6GtiqFNjknD70zDmNe";
22 };
23 };
24
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 '';
41})