summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2017-03-23 14:53:33 +0200
committerEfraim Flashner <efraim@flashner.co.il>2017-03-23 14:53:33 +0200
commit0371b345e8bffb0770b1a02ddd1c248f90566e04 (patch)
treeddfd9cc4e32193945f4891c3f77e2b8271c4a5ae /tests
parent8be563a5a39205d55fd39399e29a9272305b34c6 (diff)
parentc53af0016e283ef642ac43ccc2ee5d650f06a888 (diff)
downloadguix-0371b345e8bffb0770b1a02ddd1c248f90566e04.tar.gz
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'tests')
-rw-r--r--tests/pack.scm1
-rw-r--r--tests/publish.scm35
-rw-r--r--tests/store.scm4
3 files changed, 38 insertions, 2 deletions
diff --git a/tests/pack.scm b/tests/pack.scm
index eb643c3229..3bce715075 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -50,6 +50,7 @@
 
 (test-begin "pack")
 
+(unless (network-reachable?) (test-skip 1))
 (test-assertm "self-contained-tarball"
   (mlet* %store-monad
       ((profile (profile-derivation (packages->manifest
diff --git a/tests/publish.scm b/tests/publish.scm
index 0fd3b50ecb..ea0f4a3477 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -33,6 +33,7 @@
   #:use-module ((guix records) #:select (recutils->alist))
   #:use-module ((guix serialization) #:select (restore-file))
   #:use-module (guix pk-crypto)
+  #:use-module ((guix pki) #:select (%public-key-file %private-key-file))
   #:use-module (guix zlib)
   #:use-module (web uri)
   #:use-module (web client)
@@ -100,6 +101,10 @@
 ;; Wait until the two servers are ready.
 (wait-until-ready 6789)
 
+;; Initialize the public/private key SRFI-39 parameters.
+(%public-key (read-file-sexp %public-key-file))
+(%private-key (read-file-sexp %private-key-file))
+
 
 (test-begin "publish")
 
@@ -227,6 +232,36 @@ References: ~%"
     (list (assoc-ref info "Compression")
           (dirname (assoc-ref info "URL")))))
 
+(test-equal "custom nar path"
+  ;; Serve nars at /foo/bar/chbouib instead of /nar.
+  (list `(("StorePath" . ,%item)
+          ("URL" . ,(string-append "foo/bar/chbouib/" (basename %item)))
+          ("Compression" . "none"))
+        200
+        404)
+  (let ((thread (with-separate-output-ports
+                 (call-with-new-thread
+                  (lambda ()
+                    (guix-publish "--port=6798" "-C0"
+                                  "--nar-path=///foo/bar//chbouib/"))))))
+    (wait-until-ready 6798)
+    (let* ((base    "http://localhost:6798/")
+           (part    (store-path-hash-part %item))
+           (url     (string-append base part ".narinfo"))
+           (nar-url (string-append base "foo/bar/chbouib/"
+                                   (basename %item)))
+           (body    (http-get-port url)))
+      (list (filter (lambda (item)
+                      (match item
+                        (("Compression" . _) #t)
+                        (("StorePath" . _)  #t)
+                        (("URL" . _) #t)
+                        (_ #f)))
+                    (recutils->alist body))
+            (response-code (http-get nar-url))
+            (response-code
+             (http-get (string-append base "nar/" (basename %item))))))))
+
 (test-equal "/nar/ with properly encoded '+' sign"
   "Congrats!"
   (let ((item (add-text-to-store %store "fake-gtk+" "Congrats!")))
diff --git a/tests/store.scm b/tests/store.scm
index c0ebe7b941..45150d36ca 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -384,8 +384,8 @@
             (guard (c ((nix-protocol-error? c) #t))
               (build-derivations %store (list d))))))))
    (cond-expand
-     (guile-2.0 "garbage: ?lambda: λ")
-     (else      "garbage: �lambda: λ"))))
+     (guile-2.2 "garbage: �lambda: λ")
+     (else      "garbage: ?lambda: λ"))))
 
 (test-assert "log-file, derivation"
   (let* ((b (add-text-to-store %store "build" "echo $foo > $out" '()))