mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 04:05:40 +03:00

Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
66 lines
1.9 KiB
Nix
66 lines
1.9 KiB
Nix
# This test runs netdata and checks for data via apps.plugin
|
|
|
|
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
{
|
|
name = "netdata";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [
|
|
cransom
|
|
raitobezarius
|
|
];
|
|
};
|
|
|
|
nodes = {
|
|
netdata =
|
|
{ pkgs, ... }:
|
|
{
|
|
environment.systemPackages = with pkgs; [
|
|
curl
|
|
jq
|
|
netdata
|
|
];
|
|
services.netdata = {
|
|
enable = true;
|
|
python.recommendedPythonPackages = true;
|
|
|
|
configDir."apps_groups.conf" = pkgs.writeText "apps_groups.conf" ''
|
|
netdata_test: netdata
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
netdata.wait_for_unit("netdata.service")
|
|
|
|
# wait for the service to listen before sending a request
|
|
netdata.wait_for_open_port(19999)
|
|
|
|
# check if the netdata main page loads.
|
|
netdata.succeed("curl --fail http://localhost:19999/")
|
|
netdata.succeed("sleep 4")
|
|
|
|
# check if netdata can read disk ops for root owned processes.
|
|
# if > 0, successful. verifies both netdata working and
|
|
# apps.plugin has elevated capabilities.
|
|
url = "http://localhost:19999/api/v1/data?chart=user.root_disk_physical_io"
|
|
filter = '[.data[range(10)][2]] | add | . < 0'
|
|
cmd = f"curl -s {url} | jq -e '{filter}'"
|
|
netdata.wait_until_succeeds(cmd)
|
|
|
|
# check if the control socket is available
|
|
netdata.succeed("sudo netdatacli ping")
|
|
|
|
# check that custom groups in apps_groups.conf are used.
|
|
# if > 0, successful. verifies that user-specified apps_group.conf
|
|
# is used.
|
|
url = "http://localhost:19999/api/v1/data?chart=app.netdata_test_cpu_utilization"
|
|
filter = '[.data[range(10)][2]] | add | . > 0'
|
|
cmd = f"curl -s {url} | jq -e '{filter}'"
|
|
netdata.wait_until_succeeds(cmd, timeout=30)
|
|
'';
|
|
}
|
|
)
|