nixosTests.netdata: port to python

This commit is contained in:
Oleksii Filonenko 2019-11-24 22:26:32 +02:00 committed by Lassulus
parent 1eb951d217
commit 085766fd63

View file

@ -1,6 +1,6 @@
# This test runs netdata and checks for data via apps.plugin
import ./make-test.nix ({ pkgs, ...} : {
import ./make-test-python.nix ({ pkgs, ...} : {
name = "netdata";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ cransom ];
@ -16,23 +16,22 @@ import ./make-test.nix ({ pkgs, ...} : {
};
testScript = ''
startAll;
start_all()
$netdata->waitForUnit("netdata.service");
netdata.wait_for_unit("netdata.service")
# wait for the service to listen before sending a request
$netdata->waitForOpenPort(19999);
netdata.wait_for_open_port(19999)
# check if the netdata main page loads.
$netdata->succeed("curl --fail http://localhost:19999/");
netdata.succeed("curl --fail http://localhost:19999/")
# check if netdata can read disk ops for root owned processes.
# if > 0, successful. verifies both netdata working and
# apps.plugin has elevated capabilities.
my $cmd = <<'CMD';
curl -s http://localhost:19999/api/v1/data\?chart=users.pwrites | \
jq -e '[.data[range(10)][.labels | indices("root")[0]]] | add | . > 0'
CMD
$netdata->waitUntilSucceeds($cmd);
url = "http://localhost:19999/api/v1/data\?chart=users.pwrites"
filter = '[.data[range(10)][.labels | indices("root")[0]]] | add | . > 0'
cmd = f"curl -s {url} | jq -e '{filter}'"
netdata.wait_until_succeeds(cmd)
'';
})