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