mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-14 05:29:20 +03:00
nixos/tests/prometheus: migrate to runTest
This commit is contained in:
parent
9f489ef1a6
commit
008a4657dd
8 changed files with 597 additions and 676 deletions
|
@ -1115,7 +1115,7 @@ in
|
||||||
private-gpt = handleTest ./private-gpt.nix { };
|
private-gpt = handleTest ./private-gpt.nix { };
|
||||||
privatebin = runTest ./privatebin.nix;
|
privatebin = runTest ./privatebin.nix;
|
||||||
privoxy = handleTest ./privoxy.nix { };
|
privoxy = handleTest ./privoxy.nix { };
|
||||||
prometheus = handleTest ./prometheus { };
|
prometheus = import ./prometheus { inherit runTest; };
|
||||||
prometheus-exporters = handleTest ./prometheus-exporters.nix { };
|
prometheus-exporters = handleTest ./prometheus-exporters.nix { };
|
||||||
prosody = handleTest ./xmpp/prosody.nix { };
|
prosody = handleTest ./xmpp/prosody.nix { };
|
||||||
prosody-mysql = handleTest ./xmpp/prosody-mysql.nix { };
|
prosody-mysql = handleTest ./xmpp/prosody-mysql.nix { };
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import ../make-test-python.nix (
|
{ pkgs, ... }:
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "prometheus-alertmanager";
|
name = "prometheus-alertmanager";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -20,11 +19,7 @@ import ../make-test-python.nix (
|
||||||
{
|
{
|
||||||
scheme = "http";
|
scheme = "http";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{
|
{ targets = [ "alertmanager:${toString config.services.prometheus.alertmanager.port}" ]; }
|
||||||
targets = [
|
|
||||||
"alertmanager:${toString config.services.prometheus.alertmanager.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -48,21 +43,13 @@ import ../make-test-python.nix (
|
||||||
{
|
{
|
||||||
job_name = "alertmanager";
|
job_name = "alertmanager";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{
|
{ targets = [ "alertmanager:${toString config.services.prometheus.alertmanager.port}" ]; }
|
||||||
targets = [
|
|
||||||
"alertmanager:${toString config.services.prometheus.alertmanager.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
job_name = "node";
|
job_name = "node";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{
|
{ targets = [ "node:${toString config.services.prometheus.exporters.node.port}" ]; }
|
||||||
targets = [
|
|
||||||
"node:${toString config.services.prometheus.exporters.node.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -156,5 +143,4 @@ import ../make-test-python.nix (
|
||||||
|
|
||||||
alertmanager.log(alertmanager.succeed("systemd-analyze security alertmanager.service | grep -v '✓'"))
|
alertmanager.log(alertmanager.succeed("systemd-analyze security alertmanager.service | grep -v '✓'"))
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
import ../make-test-python.nix (
|
{
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "prometheus-config-reload";
|
name = "prometheus-config-reload";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -19,13 +16,7 @@ import ../make-test-python.nix (
|
||||||
scrapeConfigs = [
|
scrapeConfigs = [
|
||||||
{
|
{
|
||||||
job_name = "prometheus";
|
job_name = "prometheus";
|
||||||
static_configs = [
|
static_configs = [ { targets = [ "prometheus:${toString config.services.prometheus.port}" ]; } ];
|
||||||
{
|
|
||||||
targets = [
|
|
||||||
"prometheus:${toString config.services.prometheus.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -42,9 +33,7 @@ import ../make-test-python.nix (
|
||||||
{
|
{
|
||||||
job_name = "node";
|
job_name = "node";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{
|
{ targets = [ "node:${toString config.services.prometheus.exporters.node.port}" ]; }
|
||||||
targets = [ "node:${toString config.services.prometheus.exporters.node.port}" ];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -116,5 +105,4 @@ import ../make-test-python.nix (
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
{
|
{ runTest }:
|
||||||
system ? builtins.currentSystem,
|
|
||||||
config ? { },
|
|
||||||
pkgs ? import ../../.. { inherit system config; },
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
alertmanager = import ./alertmanager.nix { inherit system pkgs; };
|
alertmanager = runTest ./alertmanager.nix;
|
||||||
config-reload = import ./config-reload.nix { inherit system pkgs; };
|
config-reload = runTest ./config-reload.nix;
|
||||||
federation = import ./federation.nix { inherit system pkgs; };
|
federation = runTest ./federation.nix;
|
||||||
prometheus-pair = import ./prometheus-pair.nix { inherit system pkgs; };
|
prometheus-pair = runTest ./prometheus-pair.nix;
|
||||||
pushgateway = import ./pushgateway.nix { inherit system pkgs; };
|
pushgateway = runTest ./pushgateway.nix;
|
||||||
remote-write = import ./remote-write.nix { inherit system pkgs; };
|
remote-write = runTest ./remote-write.nix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
import ../make-test-python.nix (
|
{
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "prometheus-federation";
|
name = "prometheus-federation";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -116,22 +113,12 @@ import ../make-test-python.nix (
|
||||||
{
|
{
|
||||||
job_name = "node";
|
job_name = "node";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{
|
{ targets = [ "node1:${toString config.services.prometheus.exporters.node.port}" ]; }
|
||||||
targets = [
|
|
||||||
"node1:${toString config.services.prometheus.exporters.node.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
job_name = "prometheus";
|
job_name = "prometheus";
|
||||||
static_configs = [
|
static_configs = [ { targets = [ "prometheus1:${toString config.services.prometheus.port}" ]; } ];
|
||||||
{
|
|
||||||
targets = [
|
|
||||||
"prometheus1:${toString config.services.prometheus.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -152,22 +139,12 @@ import ../make-test-python.nix (
|
||||||
{
|
{
|
||||||
job_name = "node";
|
job_name = "node";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{
|
{ targets = [ "node2:${toString config.services.prometheus.exporters.node.port}" ]; }
|
||||||
targets = [
|
|
||||||
"node2:${toString config.services.prometheus.exporters.node.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
job_name = "prometheus";
|
job_name = "prometheus";
|
||||||
static_configs = [
|
static_configs = [ { targets = [ "prometheus2:${toString config.services.prometheus.port}" ]; } ];
|
||||||
{
|
|
||||||
targets = [
|
|
||||||
"prometheus2:${toString config.services.prometheus.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -223,5 +200,4 @@ import ../make-test-python.nix (
|
||||||
+ "jq '.data.result[0].value[1]' | grep '\"4\"'"
|
+ "jq '.data.result[0].value[1]' | grep '\"4\"'"
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import ../make-test-python.nix (
|
{ pkgs, ... }:
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "prometheus-pair";
|
name = "prometheus-pair";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -89,5 +88,4 @@ import ../make-test-python.nix (
|
||||||
|
|
||||||
prometheus1.log(prometheus1.succeed("systemd-analyze security prometheus.service | grep -v '✓'"))
|
prometheus1.log(prometheus1.succeed("systemd-analyze security prometheus.service | grep -v '✓'"))
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import ../make-test-python.nix (
|
{ pkgs, ... }:
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "prometheus-pushgateway";
|
name = "prometheus-pushgateway";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -19,13 +18,7 @@ import ../make-test-python.nix (
|
||||||
scrapeConfigs = [
|
scrapeConfigs = [
|
||||||
{
|
{
|
||||||
job_name = "pushgateway";
|
job_name = "pushgateway";
|
||||||
static_configs = [
|
static_configs = [ { targets = [ "pushgateway:9091" ]; } ];
|
||||||
{
|
|
||||||
targets = [
|
|
||||||
"pushgateway:9091"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -41,10 +34,7 @@ import ../make-test-python.nix (
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
client =
|
client = { config, pkgs, ... }: { };
|
||||||
{ config, pkgs, ... }:
|
|
||||||
{
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
|
@ -98,5 +88,4 @@ import ../make-test-python.nix (
|
||||||
|
|
||||||
pushgateway.log(pushgateway.succeed("systemd-analyze security pushgateway.service | grep -v '✓'"))
|
pushgateway.log(pushgateway.succeed("systemd-analyze security pushgateway.service | grep -v '✓'"))
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
import ../make-test-python.nix (
|
{
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "prometheus-remote-write";
|
name = "prometheus-remote-write";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -31,21 +28,13 @@ import ../make-test-python.nix (
|
||||||
enable = true;
|
enable = true;
|
||||||
globalConfig.scrape_interval = "2s";
|
globalConfig.scrape_interval = "2s";
|
||||||
|
|
||||||
remoteWrite = [
|
remoteWrite = [ { url = "http://receiver:9090/api/v1/write"; } ];
|
||||||
{
|
|
||||||
url = "http://receiver:9090/api/v1/write";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
scrapeConfigs = [
|
scrapeConfigs = [
|
||||||
{
|
{
|
||||||
job_name = "node";
|
job_name = "node";
|
||||||
static_configs = [
|
static_configs = [
|
||||||
{
|
{ targets = [ "node:${toString config.services.prometheus.exporters.node.port}" ]; }
|
||||||
targets = [
|
|
||||||
"node:${toString config.services.prometheus.exporters.node.port}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -77,5 +66,4 @@ import ../make-test-python.nix (
|
||||||
+ "jq '.data.result[0].value[1]' | grep '\"1\"'"
|
+ "jq '.data.result[0].value[1]' | grep '\"1\"'"
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue