Skip to content

Commit b87e4cc

Browse files
committed
nixos/prometheus: add speedtest-exporter tests
Add tests for the prometheus-speedtest-exporter, enabling service, debug mode, and refresh interval configuration. Also links the test in the package's passthru.tests for integration with NixOS test infrastructure.
1 parent 3497b38 commit b87e4cc

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

nixos/tests/prometheus-exporters.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,20 @@ let
16121612
'';
16131613
};
16141614

1615+
speedtest = {
1616+
exporterConfig = {
1617+
enable = true;
1618+
debug = true;
1619+
refreshInterval = "1h";
1620+
};
1621+
1622+
exporterTest = ''
1623+
wait_for_unit("prometheus-speedtest-exporter.service")
1624+
wait_for_open_port(9876)
1625+
succeed("curl -sSf http://localhost:9876")
1626+
'';
1627+
};
1628+
16151629
storagebox = {
16161630
exporterConfig = {
16171631
enable = true;

pkgs/by-name/pr/prometheus-speedtest-exporter/package.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
buildGoModule,
33
fetchFromGitHub,
44
lib,
5+
nixosTests,
56
}:
67

78
buildGoModule rec {
@@ -25,6 +26,8 @@ buildGoModule rec {
2526
"-X main.version=${version}"
2627
];
2728

29+
passthru.tests = { inherit (nixosTests.prometheus-exporters) speedtest; };
30+
2831
meta = {
2932
homepage = "https://github.com/caarlos0/speedtest-exporter";
3033
description = "Exports speedtests as prometheus metrics";

0 commit comments

Comments
 (0)