about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Gerbet <thomas@gerbet.me>2023-12-03 12:34:54 +0100
committerGitHub <noreply@github.com>2023-12-03 12:34:54 +0100
commiteac9180f29e108a52cb5384caa802da736c2c3bc (patch)
tree769cb08bd21653b5b4f13644103ab918c0f3de4a
parent4d139f4f0e0b3d6ac2620fcb7ec07d3bc2cbe789 (diff)
parent330d2db19fa25fad7e3d9b5066b5fd82cd66bbe3 (diff)
downloadnixlib-eac9180f29e108a52cb5384caa802da736c2c3bc.tar
nixlib-eac9180f29e108a52cb5384caa802da736c2c3bc.tar.gz
nixlib-eac9180f29e108a52cb5384caa802da736c2c3bc.tar.bz2
nixlib-eac9180f29e108a52cb5384caa802da736c2c3bc.tar.lz
nixlib-eac9180f29e108a52cb5384caa802da736c2c3bc.tar.xz
nixlib-eac9180f29e108a52cb5384caa802da736c2c3bc.tar.zst
nixlib-eac9180f29e108a52cb5384caa802da736c2c3bc.zip
Merge pull request #264685 from Ma27/grafana-tests
grafana: skip two more flaky tests
-rw-r--r--pkgs/servers/monitoring/grafana/default.nix19
1 files changed, 15 insertions, 4 deletions
diff --git a/pkgs/servers/monitoring/grafana/default.nix b/pkgs/servers/monitoring/grafana/default.nix
index c4c9c75903a2..d224a7695f96 100644
--- a/pkgs/servers/monitoring/grafana/default.nix
+++ b/pkgs/servers/monitoring/grafana/default.nix
@@ -22,7 +22,16 @@ buildGoModule rec {
 
   nativeBuildInputs = [ wire ];
 
-  preBuild = ''
+  preBuild = let
+    skipTest = lineOffset: testCase: file:
+      let
+        jumpAndAppend = lib.concatStringsSep ";" (lib.replicate (lineOffset - 1) "n" ++ [ "a" ]);
+      in ''
+        sed -i -e '/${testCase}/{
+        ${jumpAndAppend} t.Skip();
+        }' ${file}
+      '';
+  in ''
     # Generate DI code that's required to compile the package.
     # From https://github.com/grafana/grafana/blob/v8.2.3/Makefile#L33-L35
     wire gen -tags oss ./pkg/server
@@ -42,12 +51,14 @@ buildGoModule rec {
     # [...]
     # grafana> t=2021-12-02T14:24:58+0000 lvl=dbug msg="Failed to get latest.json repo from github.com" logger=update.checker error="Get \"https://raw.githubusercontent.com/grafana/grafana/main/latest.json\": dial tcp: lookup raw.githubusercontent.com on [::1]:53: read udp [::1]:36391->[::1]:53: read: connection refused"
     # grafana> t=2021-12-02T14:24:58+0000 lvl=dbug msg="Failed to get plugins repo from grafana.com" logger=plugin.manager error="Get \"https://grafana.com/api/plugins/versioncheck?slugIn=&grafanaVersion=\": dial tcp: lookup grafana.com on [::1]:53: read udp [::1]:41796->[::1]:53: read: connection refused"
-    sed -i -e '/Request is not forbidden if from an admin/a t.Skip();' pkg/tests/api/plugins/api_plugins_test.go
+    ${skipTest 1 "Request is not forbidden if from an admin" "pkg/tests/api/plugins/api_plugins_test.go"}
 
     # Skip a flaky test (https://github.com/NixOS/nixpkgs/pull/126928#issuecomment-861424128)
-    sed -i -e '/it should change folder successfully and return correct result/{N;s/$/\nt.Skip();/}'\
-      pkg/services/libraryelements/libraryelements_patch_test.go
+    ${skipTest 2 "it should change folder successfully and return correct result" "pkg/services/libraryelements/libraryelements_patch_test.go"}
 
+    # Skip flaky tests (https://logs.ofborg.org/?key=nixos/nixpkgs.263185&attempt_id=5b056a17-67a7-4b74-9dc7-888eb1d6c2dd)
+    ${skipTest 1 "TestIntegrationRulerAccess" "pkg/tests/api/alerting/api_alertmanager_test.go"}
+    ${skipTest 1 "TestIntegrationRulePause" "pkg/tests/api/alerting/api_ruler_test.go"}
 
     # main module (github.com/grafana/grafana) does not contain package github.com/grafana/grafana/scripts/go
     rm -r scripts/go