summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-08-01 17:42:09 +0200
committerLudovic Courtès <ludo@gnu.org>2016-08-01 17:58:56 +0200
commit089b167812624cc69aac95d5a1b69688e3f97117 (patch)
tree2255fe27e3356307e33c20c2281d60bbfbec293b /tests
parent66c65aafa73f9ca816825abb7f84b353f7bcfdf6 (diff)
downloadguix-089b167812624cc69aac95d5a1b69688e3f97117.tar.gz
publish: Do not compress already-compressed files.
* guix/scripts/publish.scm (narinfo-string): Force %NO-COMPRESSION when
STORE-PATH matches 'compressed-file?'.
* guix/utils.scm (compressed-file?): New procedure.
* tests/publish.scm ("/*.narinfo for a compressed file"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/publish.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/publish.scm b/tests/publish.scm
index 4dc807505c..7499553aeb 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -200,6 +200,20 @@ References: ~%"
                   (_ #f)))
               (recutils->alist body)))))
 
+(unless (zlib-available?)
+  (test-skip 1))
+(test-equal "/*.narinfo for a compressed file"
+  '("none" "nar")          ;compression-less nar
+  ;; Assume 'guix publish -C' is already running on port 6799.
+  (let* ((item (add-text-to-store %store "fake.tar.gz"
+                                  "This is a fake compressed file."))
+         (url  (string-append "http://localhost:6799/"
+                              (store-path-hash-part item) ".narinfo"))
+         (body (http-get-port url))
+         (info (recutils->alist body)))
+    (list (assoc-ref info "Compression")
+          (dirname (assoc-ref info "URL")))))
+
 (test-equal "/nar/ with properly encoded '+' sign"
   "Congrats!"
   (let ((item (add-text-to-store %store "fake-gtk+" "Congrats!")))