From 63716d18fc20fb0965fe298de48c29aff92002aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Fri, 25 Apr 2025 21:47:45 +0200 Subject: [PATCH] prometheus-redis-exporter: enable tests --- .../monitoring/prometheus/redis-exporter.nix | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/monitoring/prometheus/redis-exporter.nix b/pkgs/servers/monitoring/prometheus/redis-exporter.nix index 1f3289574c08..4c83cb8beac8 100644 --- a/pkgs/servers/monitoring/prometheus/redis-exporter.nix +++ b/pkgs/servers/monitoring/prometheus/redis-exporter.nix @@ -3,6 +3,9 @@ buildGoModule, fetchFromGitHub, nixosTests, + + # Test dependencies + redisTestHook, }: buildGoModule rec { @@ -24,8 +27,31 @@ buildGoModule rec { "-X main.BuildDate=unknown" ]; - # needs a redis server - doCheck = false; + nativeCheckInputs = [ + redisTestHook + ]; + + preCheck = '' + export TEST_REDIS_URI="redis://localhost:6379" + ''; + + __darwinAllowLocalNetworking = true; + + checkFlags = + let + skippedTests = [ + "TestLatencySpike" # timing-sensitive + + # The following tests require ad-hoc generated TLS certificates in the source dir. + # This is not possible in the read-only Nix store. + "TestCreateClientTLSConfig" + "TestValkeyTLSScheme" + "TestCreateServerTLSConfig" + "TestGetServerCertificateFunc" + "TestGetConfigForClientFunc" + ]; + in + [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ]; passthru.tests = { inherit (nixosTests.prometheus-exporters) redis; };