nixpkgs/nixos/tests/magnetico.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
990 B
Nix
Raw Permalink Normal View History

2019-11-13 18:17:32 +00:00
import ./make-test-python.nix ({ pkgs, ...} :
let
port = 8081;
in
{
2019-08-28 08:34:29 +00:00
name = "magnetico";
meta = with pkgs.lib.maintainers; {
2019-08-28 08:34:29 +00:00
maintainers = [ rnhmjoj ];
};
2022-03-20 23:15:30 +00:00
nodes.machine = { ... }: {
2019-08-28 08:34:29 +00:00
imports = [ ../modules/profiles/minimal.nix ];
networking.firewall.allowedTCPPorts = [ 9000 ];
services.magnetico = {
enable = true;
crawler.port = 9000;
web.port = port;
2019-08-28 08:34:29 +00:00
web.credentials.user = "$2y$12$P88ZF6soFthiiAeXnz64aOWDsY3Dw7Yw8fZ6GtiqFNjknD70zDmNe";
};
};
testScript =
''
2019-11-13 18:17:32 +00:00
start_all()
machine.wait_for_unit("magneticod")
machine.wait_for_unit("magneticow")
machine.wait_for_open_port(${toString port})
2019-11-13 18:17:32 +00:00
machine.succeed(
"${pkgs.curl}/bin/curl --fail "
2019-11-13 18:17:32 +00:00
+ "-u user:password http://localhost:${toString port}"
)
machine.fail(
"${pkgs.curl}/bin/curl --fail "
2019-11-13 18:17:32 +00:00
+ "-u user:wrongpwd http://localhost:${toString port}"
)
machine.shutdown()
2019-08-28 08:34:29 +00:00
'';
})