at 18.09-beta 1.1 kB view raw
1# This test runs netdata and checks for data via apps.plugin 2 3import ./make-test.nix ({ pkgs, ...} : { 4 name = "netdata"; 5 meta = with pkgs.stdenv.lib.maintainers; { 6 maintainers = [ cransom ]; 7 }; 8 9 nodes = { 10 netdata = 11 { pkgs, ... }: 12 { 13 environment.systemPackages = with pkgs; [ curl jq ]; 14 services.netdata.enable = true; 15 }; 16 }; 17 18 testScript = '' 19 startAll; 20 21 $netdata->waitForUnit("netdata.service"); 22 23 # wait for the service to listen before sending a request 24 $netdata->waitForOpenPort(19999); 25 26 # check if the netdata main page loads. 27 $netdata->succeed("curl --fail http://localhost:19999/"); 28 29 # check if netdata can read disk ops for root owned processes. 30 # if > 0, successful. verifies both netdata working and 31 # apps.plugin has elevated capabilities. 32 my $cmd = <<'CMD'; 33 curl -s http://localhost:19999/api/v1/data\?chart=users.pwrites | \ 34 jq -e '[.data[range(10)][.labels | indices("root")[0]]] | add | . > 0' 35 CMD 36 $netdata->waitUntilSucceeds($cmd); 37 ''; 38})