nixosTests.netdata: port to python
This commit is contained in:
parent
1eb951d217
commit
085766fd63
@ -1,6 +1,6 @@
|
|||||||
# This test runs netdata and checks for data via apps.plugin
|
# This test runs netdata and checks for data via apps.plugin
|
||||||
|
|
||||||
import ./make-test.nix ({ pkgs, ...} : {
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
name = "netdata";
|
name = "netdata";
|
||||||
meta = with pkgs.stdenv.lib.maintainers; {
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
maintainers = [ cransom ];
|
maintainers = [ cransom ];
|
||||||
@ -16,23 +16,22 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
startAll;
|
start_all()
|
||||||
|
|
||||||
$netdata->waitForUnit("netdata.service");
|
netdata.wait_for_unit("netdata.service")
|
||||||
|
|
||||||
# wait for the service to listen before sending a request
|
# 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.
|
# 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.
|
# check if netdata can read disk ops for root owned processes.
|
||||||
# if > 0, successful. verifies both netdata working and
|
# if > 0, successful. verifies both netdata working and
|
||||||
# apps.plugin has elevated capabilities.
|
# apps.plugin has elevated capabilities.
|
||||||
my $cmd = <<'CMD';
|
url = "http://localhost:19999/api/v1/data\?chart=users.pwrites"
|
||||||
curl -s http://localhost:19999/api/v1/data\?chart=users.pwrites | \
|
filter = '[.data[range(10)][.labels | indices("root")[0]]] | add | . > 0'
|
||||||
jq -e '[.data[range(10)][.labels | indices("root")[0]]] | add | . > 0'
|
cmd = f"curl -s {url} | jq -e '{filter}'"
|
||||||
CMD
|
netdata.wait_until_succeeds(cmd)
|
||||||
$netdata->waitUntilSucceeds($cmd);
|
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user