tests: getmail: Provide a pre-initialized user account password.

* gnu/tests/mail.scm (%getmail-os): Rewrite so that the "alice" account
has a password.
(run-getmail-test)[test]("set password for alice"): Remove.  This would
not work since commit 8b9cad01e9619f53dc5a65892ca6a09ca5de3447 since
'passwd' would no longer be in $PATH.
This commit is contained in:
Ludovic Courtès 2020-03-09 23:32:44 +01:00
parent 0e42a1643e
commit 827abd5deb
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org> ;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org>
;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au> ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2019 Christopher Baines <mail@cbaines.net> ;;; Copyright © 2019 Christopher Baines <mail@cbaines.net>
@ -26,8 +26,11 @@
#:use-module (gnu tests) #:use-module (gnu tests)
#:use-module (gnu packages mail) #:use-module (gnu packages mail)
#:use-module (gnu system) #:use-module (gnu system)
#:use-module (gnu system accounts)
#:use-module (gnu system shadow)
#:use-module (gnu system vm) #:use-module (gnu system vm)
#:use-module (gnu services) #:use-module (gnu services)
#:use-module (gnu services base)
#:use-module (gnu services getmail) #:use-module (gnu services getmail)
#:use-module (gnu services mail) #:use-module (gnu services mail)
#:use-module (gnu services networking) #:use-module (gnu services networking)
@ -404,43 +407,55 @@ Subject: Hello Nice to meet you!")
(value (run-dovecot-test)))) (value (run-dovecot-test))))
(define %getmail-os (define %getmail-os
(simple-operating-system (operating-system
(service dhcp-client-service-type) (inherit (simple-operating-system))
(service dovecot-service-type
(dovecot-configuration ;; Set a password for the user account; the test needs it.
(disable-plaintext-auth? #f) (users (cons (user-account
(ssl? "no") (name "alice")
(auth-mechanisms '("anonymous" "plain")) (password (crypt "testpass" "$6$abc"))
(auth-anonymous-username "alice") (comment "Bob's sister")
(mail-location (group "users")
(string-append "maildir:~/Maildir" (supplementary-groups '("wheel" "audio" "video")))
":INBOX=~/Maildir/INBOX" %base-user-accounts))
":LAYOUT=fs"))))
(service getmail-service-type (services (cons* (service dhcp-client-service-type)
(list (service dovecot-service-type
(getmail-configuration (dovecot-configuration
(name 'test) (disable-plaintext-auth? #f)
(user "alice") (ssl? "no")
(directory "/var/lib/getmail/alice") (auth-mechanisms '("anonymous" "plain"))
(idle '("TESTBOX")) (auth-anonymous-username "alice")
(rcfile (mail-location
(getmail-configuration-file (string-append "maildir:~/Maildir"
(retriever ":INBOX=~/Maildir/INBOX"
(getmail-retriever-configuration ":LAYOUT=fs"))))
(type "SimpleIMAPRetriever") (service getmail-service-type
(server "localhost") (list
(username "alice") (getmail-configuration
(port 143) (name 'test)
(extra-parameters (user "alice")
'((password . "testpass") (directory "/var/lib/getmail/alice")
(mailboxes . ("TESTBOX")))))) (idle '("TESTBOX"))
(destination (rcfile
(getmail-destination-configuration (getmail-configuration-file
(type "Maildir") (retriever
(path "/home/alice/TestMaildir/"))) (getmail-retriever-configuration
(options (type "SimpleIMAPRetriever")
(getmail-options-configuration (server "localhost")
(read-all #f)))))))))) (username "alice")
(port 143)
(extra-parameters
'((password . "testpass")
(mailboxes . ("TESTBOX"))))))
(destination
(getmail-destination-configuration
(type "Maildir")
(path "/home/alice/TestMaildir/")))
(options
(getmail-options-configuration
(read-all #f))))))))
%base-services))))
(define (run-getmail-test) (define (run-getmail-test)
"Return a test of an OS running Getmail service." "Return a test of an OS running Getmail service."
@ -483,11 +498,6 @@ Subject: Hello Nice to meet you!")
(start-service 'dovecot)) (start-service 'dovecot))
marionette)) marionette))
(test-assert "set password for alice"
(marionette-eval
'(system "echo -e \"testpass\ntestpass\" | passwd alice")
marionette))
;; Wait for getmail to be up and running. ;; Wait for getmail to be up and running.
(test-assert "getmail-test running" (test-assert "getmail-test running"
(marionette-eval (marionette-eval