summary refs log tree commit diff
path: root/tests/publish.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2018-01-11 14:22:50 -0800
committerLeo Famulari <leo@famulari.name>2018-01-11 14:22:50 -0800
commit4adb40bffc0dda8871878283887a0e0cd88d9578 (patch)
tree74d5fb686116002da72de4a1075d0ed8f307cec1 /tests/publish.scm
parent4610ab7c9a5327df0d475262817bc081a5891aa8 (diff)
parent138c08899ba73049de8afd2b74a8cf6845a1d9e1 (diff)
downloadguix-4adb40bffc0dda8871878283887a0e0cd88d9578.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests/publish.scm')
-rw-r--r--tests/publish.scm28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/publish.scm b/tests/publish.scm
index 352caf5325..bd1a75cf00 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
+;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -439,4 +440,31 @@ FileSize: ~a~%"
                          (assoc-ref narinfo "FileSize"))
                         (response-code compressed))))))))))
 
+(test-equal "/log/NAME"
+  `(200 #t application/x-bzip2)
+  (let ((drv (run-with-store %store
+               (gexp->derivation "with-log"
+                                 #~(call-with-output-file #$output
+                                     (lambda (port)
+                                       (display "Hello, build log!"
+                                                (current-error-port))
+                                       (display "" port)))))))
+    (build-derivations %store (list drv))
+    (let* ((response (http-get
+                      (publish-uri (string-append "/log/"
+                                                  (basename (derivation->output-path drv))))
+                      #:decode-body? #f))
+           (base     (basename (derivation-file-name drv)))
+           (log      (string-append (dirname %state-directory)
+                                    "/log/guix/drvs/" (string-take base 2)
+                                    "/" (string-drop base 2) ".bz2")))
+      (list (response-code response)
+            (= (response-content-length response) (stat:size (stat log)))
+            (first (response-content-type response))))))
+
+(test-equal "/log/NAME not found"
+  404
+  (let ((uri (publish-uri "/log/does-not-exist")))
+    (response-code (http-get uri))))
+
 (test-end "publish")