summary refs log tree commit diff
path: root/tests/store.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-12-08 14:03:33 +0100
committerLudovic Courtès <ludo@gnu.org>2016-12-08 23:12:11 +0100
commit13d5e8dae5f1282eac630dea428c5fe3dc073fb4 (patch)
tree41470d93b695ea0ebfb552cb77024f92ba5fa62c /tests/store.scm
parent0c69a17efdba0c7c3da0f25800a3c3233200e47b (diff)
downloadguix-13d5e8dae5f1282eac630dea428c5fe3dc073fb4.tar.gz
store: 'open-connection' no longer raises '&nar-error' for protocol errors.
* guix/store.scm (open-connection): Guard body against 'nar-error?' and
re-raise as '&nix-connection-error'.
* tests/store.scm ("connection handshake error"): New test.
Diffstat (limited to 'tests/store.scm')
-rw-r--r--tests/store.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/store.scm b/tests/store.scm
index 38b8efce96..123ea8a787 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -48,6 +48,15 @@
 
 (test-begin "store")
 
+(test-equal "connection handshake error"
+  EPROTO
+  (let ((port (%make-void-port "rw")))
+    (guard (c ((nix-connection-error? c)
+               (and (eq? port (nix-connection-error-file c))
+                    (nix-connection-error-code c))))
+      (open-connection #f #:port port)
+      'broken)))
+
 (test-equal "store-path-hash-part"
   "283gqy39v3g9dxjy26rynl0zls82fmcg"
   (store-path-hash-part