aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSharlatan Hellseher <sharlatanus@gmail.com>2024-08-25 17:35:26 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2024-08-25 20:46:49 +0100
commit0fc1ce6f4f7c2987525addb8cba022d0b0830e99 (patch)
tree2e2f90ccd54659f9d199e1a3c97fa766b18e05ed
parent0e8fd31a3d07ae491fff5c0e468cbe58454d6b7d (diff)
downloadguix-0fc1ce6f4f7c2987525addb8cba022d0b0830e99.tar.gz
guix-0fc1ce6f4f7c2987525addb8cba022d0b0830e99.zip
gnu: go-github-com-prometheus-procfs: Enable tests.
* gnu/packages/prometheus.scm (go-github-com-prometheus-procfs): Enable tests. [arguments] <#:phases>: Add 'unpack-testdata and 'remove-testdata phases. Use custom 'check phase. Change-Id: Iae01ce9cb57748ce4b155e2b814dd69ff9ba5114
-rw-r--r--gnu/packages/prometheus.scm19
1 files changed, 16 insertions, 3 deletions
diff --git a/gnu/packages/prometheus.scm b/gnu/packages/prometheus.scm
index d1387af9aa..449086c566 100644
--- a/gnu/packages/prometheus.scm
+++ b/gnu/packages/prometheus.scm
@@ -399,9 +399,22 @@ from the default AWS credential chain.")
(arguments
(list
#:import-path "github.com/prometheus/procfs"
- ;; The tests require Go modules, which are not yet supported in Guix's
- ;; Go build system.
- #:tests? #f))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'check 'unpack-testdata
+ (lambda* (#:key tests? import-path #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ (invoke "./ttar" "-C" "testdata/" "-x" "-f" "testdata/fixtures.ttar"))))
+ ;; XXX: Replace when go-build-system supports nested path.
+ (replace 'check
+ (lambda* (#:key import-path tests? #:allow-other-keys)
+ (when tests?
+ (with-directory-excursion (string-append "src/" import-path)
+ (invoke "go" "test" "-v" "./...")))))
+ (add-after 'check 'remove-testdata
+ (lambda* (#:key tests? import-path #:allow-other-keys)
+ (with-directory-excursion (string-append "src/" import-path)
+ (delete-file-recursively "testdata")))))))
(propagated-inputs
(list go-github-com-google-go-cmp
go-golang-org-x-sync