diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2022-12-19 12:04:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-19 12:04:22 +0100 |
commit | 6f8f1b045427f59bd10273e27f9e08941e1b9ad5 (patch) | |
tree | 41beb0ca06c10bf48850d6b5a79de076c0095ab4 /nixos/tests | |
parent | a4b24da293ea1b45b6dc66ef323f9dc878423c2e (diff) | |
parent | a0b60725473c3f0646f5b6f9b1352a8d848c8b9e (diff) |
Merge pull request #205865 from DeeUnderscore/fix/grafana-socket
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/grafana/basic.nix | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/nixos/tests/grafana/basic.nix b/nixos/tests/grafana/basic.nix index f6566d4497098..8bf4caad7fbfc 100644 --- a/nixos/tests/grafana/basic.nix +++ b/nixos/tests/grafana/basic.nix @@ -25,6 +25,22 @@ let extraNodeConfs = { sqlite = {}; + socket = { config, ... }: { + services.grafana.settings.server = { + protocol = "socket"; + socket = "/run/grafana/sock"; + socket_gid = config.users.groups.nginx.gid; + }; + + users.users.grafana.extraGroups = [ "nginx" ]; + + services.nginx = { + enable = true; + recommendedProxySettings = true; + virtualHosts."_".locations."/".proxyPass = "http://unix:/run/grafana/sock"; + }; + }; + declarativePlugins = { services.grafana.declarativePlugins = [ pkgs.grafanaPlugins.grafana-clock-panel ]; }; @@ -92,6 +108,17 @@ in { ) sqlite.shutdown() + with subtest("Successful API query as admin user with sqlite db listening on socket"): + socket.wait_for_unit("grafana.service") + socket.wait_for_open_port(80) + print(socket.succeed( + "curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1/api/org/users -i" + )) + socket.succeed( + "curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1/api/org/users | grep admin\@localhost" + ) + socket.shutdown() + with subtest("Successful API query as admin user with postgresql db"): postgresql.wait_for_unit("grafana.service") postgresql.wait_for_unit("postgresql.service") |