forked from mirrors/nixpkgs
nixos/tests/grafana: port to python
This commit is contained in:
parent
9a7101c999
commit
34755fb5e4
|
@ -1,4 +1,4 @@
|
|||
import ./make-test.nix ({ lib, pkgs, ... }:
|
||||
import ./make-test-python.nix ({ lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkMerge nameValuePair maintainers;
|
||||
|
@ -64,28 +64,34 @@ in {
|
|||
inherit nodes;
|
||||
|
||||
testScript = ''
|
||||
startAll();
|
||||
start_all()
|
||||
|
||||
subtest "Grafana sqlite", sub {
|
||||
$sqlite->waitForUnit("grafana.service");
|
||||
$sqlite->waitForOpenPort(3000);
|
||||
$sqlite->succeed("curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1:3000/api/org/users | grep -q testadmin\@localhost");
|
||||
};
|
||||
with subtest("Successful API query as admin user with sqlite db"):
|
||||
sqlite.wait_for_unit("grafana.service")
|
||||
sqlite.wait_for_open_port(3000)
|
||||
sqlite.succeed(
|
||||
"curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1:3000/api/org/users | grep -q testadmin\@localhost"
|
||||
)
|
||||
sqlite.shutdown()
|
||||
|
||||
subtest "Grafana postgresql", sub {
|
||||
$postgresql->waitForUnit("grafana.service");
|
||||
$postgresql->waitForUnit("postgresql.service");
|
||||
$postgresql->waitForOpenPort(3000);
|
||||
$postgresql->waitForOpenPort(5432);
|
||||
$postgresql->succeed("curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1:3000/api/org/users | grep -q testadmin\@localhost");
|
||||
};
|
||||
with subtest("Successful API query as admin user with postgresql db"):
|
||||
postgresql.wait_for_unit("grafana.service")
|
||||
postgresql.wait_for_unit("postgresql.service")
|
||||
postgresql.wait_for_open_port(3000)
|
||||
postgresql.wait_for_open_port(5432)
|
||||
postgresql.succeed(
|
||||
"curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1:3000/api/org/users | grep -q testadmin\@localhost"
|
||||
)
|
||||
postgresql.shutdown()
|
||||
|
||||
subtest "Grafana mysql", sub {
|
||||
$mysql->waitForUnit("grafana.service");
|
||||
$mysql->waitForUnit("mysql.service");
|
||||
$mysql->waitForOpenPort(3000);
|
||||
$mysql->waitForOpenPort(3306);
|
||||
$mysql->succeed("curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1:3000/api/org/users | grep -q testadmin\@localhost");
|
||||
};
|
||||
with subtest("Successful API query as admin user with mysql db"):
|
||||
mysql.wait_for_unit("grafana.service")
|
||||
mysql.wait_for_unit("mysql.service")
|
||||
mysql.wait_for_open_port(3000)
|
||||
mysql.wait_for_open_port(3306)
|
||||
mysql.succeed(
|
||||
"curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1:3000/api/org/users | grep -q testadmin\@localhost"
|
||||
)
|
||||
mysql.shutdown()
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue