summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2018-10-21 23:18:19 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2018-10-21 23:19:35 +0200
commitcf7658f7cb5de0e17f4801faa84c378a4b40033e (patch)
tree646fa120d67bb41868a543461700e62aa170b2c0 /gnu/tests
parent09c5a5680a06011f985a84aa26fb890b3be453bd (diff)
parentffddb42d6c510456997ee6de1c1b8026c9ce6d14 (diff)
Merge branch 'core-updates' into core-updates-next
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/base.scm2
-rw-r--r--gnu/tests/databases.scm4
-rw-r--r--gnu/tests/dict.scm2
-rw-r--r--gnu/tests/mail.scm6
-rw-r--r--gnu/tests/messaging.scm4
-rw-r--r--gnu/tests/monitoring.scm2
-rw-r--r--gnu/tests/networking.scm4
-rw-r--r--gnu/tests/nfs.scm2
-rw-r--r--gnu/tests/rsync.scm2
-rw-r--r--gnu/tests/ssh.scm2
-rw-r--r--gnu/tests/version-control.scm118
-rw-r--r--gnu/tests/virtualization.scm2
-rw-r--r--gnu/tests/web.scm52
13 files changed, 178 insertions, 24 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index f97581de33..896d4a8f88 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -673,7 +673,7 @@ non-ASCII names from /tmp.")
(name-service-switch %mdns-host-lookup-nss)
(services (cons* (avahi-service #:debug? #t)
(dbus-service)
- (dhcp-client-service) ;needed for multicast
+ (service dhcp-client-service-type) ;needed for multicast
;; Enable heavyweight debugging output.
(modify-services (operating-system-user-services
diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm
index 5c8ca85c13..e0544bbcd2 100644
--- a/gnu/tests/databases.scm
+++ b/gnu/tests/databases.scm
@@ -35,7 +35,7 @@
(define %memcached-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service memcached-service-type)))
(define* (run-memcached-test #:optional (port 11211))
@@ -130,7 +130,7 @@
(operating-system
(inherit
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service mongodb-service-type)))
(packages (cons* mongodb
%base-packages))))
diff --git a/gnu/tests/dict.scm b/gnu/tests/dict.scm
index dd60ffd464..c50e3cd6da 100644
--- a/gnu/tests/dict.scm
+++ b/gnu/tests/dict.scm
@@ -34,7 +34,7 @@
(define %dicod-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service dicod-service-type
(dicod-configuration
(interfaces '("0.0.0.0"))
diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm
index 5677969fac..33aa4d3437 100644
--- a/gnu/tests/mail.scm
+++ b/gnu/tests/mail.scm
@@ -36,7 +36,7 @@
(define %opensmtpd-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service opensmtpd-service-type
(opensmtpd-configuration
(config-file
@@ -155,7 +155,7 @@ accept from any for local deliver to mbox
(define %exim-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service mail-aliases-service-type '())
(service exim-service-type
(exim-configuration
@@ -283,7 +283,7 @@ acl_check_data:
(define %dovecot-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(dovecot-service #:config
(dovecot-configuration
(disable-plaintext-auth? #f)
diff --git a/gnu/tests/messaging.scm b/gnu/tests/messaging.scm
index f5f99b9f56..36afb987af 100644
--- a/gnu/tests/messaging.scm
+++ b/gnu/tests/messaging.scm
@@ -35,7 +35,7 @@
"Run a test of an OS running XMPP-SERVICE, which writes its PID to PID-FILE."
(define os
(marionette-operating-system
- (simple-operating-system (dhcp-client-service)
+ (simple-operating-system (service dhcp-client-service-type)
xmpp-service)
#:imported-modules '((gnu services herd))))
@@ -167,7 +167,7 @@
(define (run-bitlbee-test)
(define os
(marionette-operating-system
- (simple-operating-system (dhcp-client-service)
+ (simple-operating-system (service dhcp-client-service-type)
(service bitlbee-service-type
(bitlbee-configuration
(interface "0.0.0.0"))))
diff --git a/gnu/tests/monitoring.scm b/gnu/tests/monitoring.scm
index 67899987ce..3320a19a77 100644
--- a/gnu/tests/monitoring.scm
+++ b/gnu/tests/monitoring.scm
@@ -85,7 +85,7 @@
(define %prometheus-node-exporter-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service prometheus-node-exporter-service-type
(prometheus-node-exporter-configuration))))
diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm
index ceba7f7d5d..9f12a4ae8d 100644
--- a/gnu/tests/networking.scm
+++ b/gnu/tests/networking.scm
@@ -39,7 +39,7 @@
(define %inetd-os
;; Operating system with 2 inetd services.
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service inetd-service-type
(inetd-configuration
(entries (list
@@ -463,7 +463,7 @@ COMMIT
(define os
(marionette-operating-system
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service inetd-service-type
(inetd-configuration
(entries (list
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index 140f03779b..7ef9f1f7bf 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -55,7 +55,7 @@
(services (cons*
(service rpcbind-service-type
(rpcbind-configuration))
- (dhcp-client-service)
+ (service dhcp-client-service-type)
%base-services))))
(define (run-nfs-test name socket)
diff --git a/gnu/tests/rsync.scm b/gnu/tests/rsync.scm
index a6f8fa2bd1..096580022f 100644
--- a/gnu/tests/rsync.scm
+++ b/gnu/tests/rsync.scm
@@ -111,7 +111,7 @@ PORT."
;; Return operating system under test.
(let ((base-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service rsync-service-type))))
(operating-system
(inherit base-os)
diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm
index 2e40122add..e5cd439cdf 100644
--- a/gnu/tests/ssh.scm
+++ b/gnu/tests/ssh.scm
@@ -39,7 +39,7 @@ empty-password logins.
When SFTP? is true, run an SFTP server test."
(define os
(marionette-operating-system
- (simple-operating-system (dhcp-client-service) ssh-service)
+ (simple-operating-system (service dhcp-client-service-type) ssh-service)
#:imported-modules '((gnu services herd)
(guix combinators))))
(define vm
diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm
index 3b935a1b48..230aa9edf9 100644
--- a/gnu/tests/version-control.scm
+++ b/gnu/tests/version-control.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2018 Christopher Baines <mail@cbaines.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,14 +28,17 @@
#:use-module (gnu services)
#:use-module (gnu services version-control)
#:use-module (gnu services cgit)
+ #:use-module (gnu services ssh)
#:use-module (gnu services web)
#:use-module (gnu services networking)
#:use-module (gnu packages version-control)
+ #:use-module (gnu packages ssh)
#:use-module (guix gexp)
#:use-module (guix store)
#:use-module (guix modules)
#:export (%test-cgit
- %test-git-http))
+ %test-git-http
+ %test-gitolite))
(define README-contents
"Hello! This is what goes inside the 'README' file.")
@@ -88,7 +92,7 @@
;; Operating system under test.
(let ((base-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service cgit-service-type
(cgit-configuration
(nginx %cgit-configuration-nginx)))
@@ -233,7 +237,7 @@ HTTP-PORT."
(define %git-http-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service fcgiwrap-service-type)
(service nginx-service-type %git-nginx-configuration)
%test-repository-service))
@@ -300,3 +304,111 @@ HTTP-PORT."
(name "git-http")
(description "Connect to a running Git HTTP server.")
(value (run-git-http-test))))
+
+
+;;;
+;;; Gitolite.
+;;;
+
+(define %gitolite-test-admin-keypair
+ (computed-file
+ "gitolite-test-admin-keypair"
+ (with-imported-modules (source-module-closure
+ '((guix build utils)))
+ #~(begin
+ (use-modules (ice-9 match) (srfi srfi-26)
+ (guix build utils))
+
+ (mkdir #$output)
+ (invoke #$(file-append openssh "/bin/ssh-keygen")
+ "-f" (string-append #$output "/test-admin")
+ "-t" "rsa"
+ "-q"
+ "-N" "")))))
+
+(define %gitolite-os
+ (simple-operating-system
+ (service dhcp-client-service-type)
+ (service openssh-service-type)
+ (service gitolite-service-type
+ (gitolite-configuration
+ (admin-pubkey
+ (file-append %gitolite-test-admin-keypair "/test-admin.pub"))))))
+
+(define (run-gitolite-test)
+ (define os
+ (marionette-operating-system
+ %gitolite-os
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+
+ (define vm
+ (virtual-machine
+ (operating-system os)
+ (port-forwardings `((2222 . 22)))))
+
+ (define test
+ (with-imported-modules '((gnu build marionette)
+ (guix build utils))
+ #~(begin
+ (use-modules (srfi srfi-64)
+ (rnrs io ports)
+ (gnu build marionette)
+ (guix build utils))
+
+ (define marionette
+ (make-marionette (list #$vm)))
+
+ (mkdir #$output)
+ (chdir #$output)
+
+ (test-begin "gitolite")
+
+ ;; Wait for sshd to be up and running.
+ (test-assert "service running"
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+ (start-service 'ssh-daemon))
+ marionette))
+
+ (display #$%gitolite-test-admin-keypair)
+
+ (setenv "GIT_SSH_VARIANT" "ssh")
+ (setenv "GIT_SSH_COMMAND"
+ (string-join
+ '(#$(file-append openssh "/bin/ssh")
+ "-i" #$(file-append %gitolite-test-admin-keypair
+ "/test-admin")
+ "-o" "UserKnownHostsFile=/dev/null"
+ "-o" "StrictHostKeyChecking=no")))
+
+ (test-assert "cloning the admin repository"
+ (invoke #$(file-append git "/bin/git")
+ "clone" "-v"
+ "ssh://git@localhost:2222/gitolite-admin"
+ "/tmp/clone"))
+
+ (test-assert "admin key exists"
+ (file-exists? "/tmp/clone/keydir/test-admin.pub"))
+
+ (with-directory-excursion "/tmp/clone"
+ (invoke #$(file-append git "/bin/git")
+ "-c" "user.name=Guix" "-c" "user.email=guix"
+ "commit"
+ "-m" "Test commit"
+ "--allow-empty")
+
+ (test-assert "pushing, and the associated hooks"
+ (invoke #$(file-append git "/bin/git") "push")))
+
+ (test-end)
+ (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+ (gexp->derivation "gitolite" test))
+
+(define %test-gitolite
+ (system-test
+ (name "gitolite")
+ (description "Clone the Gitolite admin repository.")
+ (value (run-gitolite-test))))
diff --git a/gnu/tests/virtualization.scm b/gnu/tests/virtualization.scm
index c2939355b2..fbdec20805 100644
--- a/gnu/tests/virtualization.scm
+++ b/gnu/tests/virtualization.scm
@@ -32,7 +32,7 @@
(define %libvirt-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(dbus-service)
(polkit-service)
(service libvirt-service-type)))
diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm
index 45fcb668fb..319655396a 100644
--- a/gnu/tests/web.scm
+++ b/gnu/tests/web.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
+;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,6 +33,7 @@
#:use-module (guix store)
#:export (%test-httpd
%test-nginx
+ %test-varnish
%test-php-fpm
%test-hpcguix-web
%test-tailon))
@@ -123,7 +125,7 @@ HTTP-PORT."
(define %httpd-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service httpd-service-type
(httpd-configuration
(config
@@ -152,7 +154,7 @@ HTTP-PORT."
(define %nginx-os
;; Operating system under test.
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service nginx-service-type
(nginx-configuration
(log-directory "/var/log/nginx")
@@ -169,6 +171,46 @@ HTTP-PORT."
;;;
+;;; Varnish
+;;;
+
+(define %varnish-vcl
+ (mixed-text-file
+ "varnish-test.vcl"
+ "vcl 4.0;
+backend dummy { .host = \"127.1.1.1\"; }
+sub vcl_recv { return(synth(200, \"OK\")); }
+sub vcl_synth {
+ synthetic(\"" %index.html-contents "\");
+ set resp.http.Content-Type = \"text/plain\";
+ return(deliver);
+}"))
+
+(define %varnish-os
+ (simple-operating-system
+ (service dhcp-client-service-type)
+ ;; Pretend to be a web server that serves %index.html-contents.
+ (service varnish-service-type
+ (varnish-configuration
+ (name "/tmp/server")
+ ;; Use a small VSL buffer to fit in the test VM.
+ (parameters '(("vsl_space" . "4M")))
+ (vcl %varnish-vcl)))
+ ;; Proxy the "server" using the builtin configuration.
+ (service varnish-service-type
+ (varnish-configuration
+ (parameters '(("vsl_space" . "4M")))
+ (backend "localhost:80")
+ (listen '(":8080"))))))
+
+(define %test-varnish
+ (system-test
+ (name "varnish")
+ (description "Test the Varnish Cache server.")
+ (value (run-webserver-test "varnish-default" %varnish-os))))
+
+
+;;;
;;; PHP-FPM
;;;
@@ -195,7 +237,7 @@ echo(\"Computed by php:\".((string)(2+3)));
(define %php-fpm-os
;; Operating system under test.
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service php-fpm-service-type)
(service nginx-service-type
(nginx-configuration
@@ -350,7 +392,7 @@ HTTP-PORT, along with php-fpm."
(define %hpcguix-web-os
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service hpcguix-web-service-type
(hpcguix-web-configuration
(specs %hpcguix-web-specs)))))
@@ -365,7 +407,7 @@ HTTP-PORT, along with php-fpm."
(define %tailon-os
;; Operating system under test.
(simple-operating-system
- (dhcp-client-service)
+ (service dhcp-client-service-type)
(service tailon-service-type
(tailon-configuration
(config-file