summary refs log tree commit diff
path: root/gnu/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-06-27 21:03:28 +0200
committerLudovic Courtès <ludo@gnu.org>2016-06-27 21:41:38 +0200
commit858d372c982594bf851d2b9cf82a9fa547c9651c (patch)
tree27bbe998e480c5df5e426518057a7c20e346864b /gnu/tests
parent9009538d84d20447372c4b9ad608fae0d578815f (diff)
downloadguix-858d372c982594bf851d2b9cf82a9fa547c9651c.tar.gz
tests: base: Add host name resolution tests.
* gnu/tests/base.scm (run-basic-test)["host name resolution",
"host not found"]: New tests.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/base.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 4fe779802b..5786da512c 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -150,6 +150,27 @@ info --version")
                                 get-string-all)
                              marionette)))
 
+        (test-assert "host name resolution"
+          (match (marionette-eval
+                  '(begin
+                     ;; Wait for nscd or our requests go through it.
+                     (use-modules (gnu services herd))
+                     (start-service 'nscd)
+
+                     (list (getaddrinfo "localhost")
+                           (getaddrinfo #$(operating-system-host-name os))))
+                  marionette)
+            ((((? vector?) ..1) ((? vector?) ..1))
+             #t)
+            (x
+             (pk 'failure x #f))))
+
+        (test-equal "host not found"
+          #f
+          (marionette-eval
+           '(false-if-exception (getaddrinfo "does-not-exist"))
+           marionette))
+
         (test-assert "screendump"
           (begin
             (marionette-control (string-append "screendump " #$output