summary refs log tree commit diff
diff options
context:
space:
mode:
authorSharlatan Hellseher <sharlatanus@gmail.com>2024-07-25 07:41:56 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2024-07-25 21:01:03 +0100
commit10b868c0a7d5fdb9edc68b0d56b64723e664af14 (patch)
tree8228db505512b6006de239cac787703b74d5be73
parent818a854b3b42334b5172c60c5340f7be29abdb9d (diff)
downloadguix-10b868c0a7d5fdb9edc68b0d56b64723e664af14.tar.gz
gnu: go-github-com-prometheus-client-golang: Enable tests.
* gnu/packages/golang.scm (go-github-com-prometheus-client-golang):
Enable tests.
[arguments]: <#:phases>: Add 'remove-examples-and-tutorials and use
custom 'check phase.

Change-Id: I70de72754188b558b730b92d7561d88690b02f7c
-rw-r--r--gnu/packages/golang.scm24
1 files changed, 18 insertions, 6 deletions
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 34585a68c5..56e6c6a627 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -7390,12 +7390,24 @@ system, kernel, and process metrics from the @file{/proc} pseudo file system.")
                 "0mx5q221pbkx081ycf1lp8sxz513220ya8qczkkvab943cwlcarv"))))
     (build-system go-build-system)
     (arguments
-     '(#:tests? #f
-       #:import-path "github.com/prometheus/client_golang"
-       #:phases
-       (modify-phases %standard-phases
-         ;; Source-only package
-         (delete 'build))))
+     (list
+      #:import-path "github.com/prometheus/client_golang"
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-examples-and-tutorials
+            (lambda* (#:key import-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" import-path)
+                (for-each delete-file-recursively
+                          (list "api/prometheus/v1/example_test.go"
+                                "examples"
+                                "tutorial")))))
+          ;; XXX: Workaround for go-build-system's lack of Go modules support.
+          (delete 'build)
+          (replace 'check
+            (lambda* (#:key tests? import-path #:allow-other-keys)
+              (when tests?
+                (with-directory-excursion (string-append "src/" import-path)
+                  (invoke "go" "test" "-v" "./..."))))))))
     (propagated-inputs
      (list go-github-com-beorn7-perks
            go-github-com-cespare-xxhash-v2