guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: guix-commits
Subject: 04/04: tests: getmail: Provide a pre-initialized user account password.
Date: Mon, 9 Mar 2020 18:47:01 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 827abd5deb87c1ec15112d7cde1a03a4ba4b4983
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon Mar 9 23:32:44 2020 +0100

    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.
---
 gnu/tests/mail.scm | 96 ++++++++++++++++++++++++++++++------------------------
 1 file changed, 53 insertions(+), 43 deletions(-)

diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm
index 023f59d..298918b 100644
--- a/gnu/tests/mail.scm
+++ b/gnu/tests/mail.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Sou Bunnbu <address@hidden>
 ;;; Copyright © 2017 Carlo Zancanaro <address@hidden>
-;;; Copyright © 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2017, 2020 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2018 Oleg Pykhalov <address@hidden>
 ;;; Copyright © 2018 Clément Lassieur <address@hidden>
 ;;; Copyright © 2019 Christopher Baines <address@hidden>
@@ -26,8 +26,11 @@
   #:use-module (gnu tests)
   #:use-module (gnu packages mail)
   #:use-module (gnu system)
+  #:use-module (gnu system accounts)
+  #:use-module (gnu system shadow)
   #:use-module (gnu system vm)
   #:use-module (gnu services)
+  #:use-module (gnu services base)
   #:use-module (gnu services getmail)
   #:use-module (gnu services mail)
   #:use-module (gnu services networking)
@@ -404,43 +407,55 @@ Subject: Hello Nice to meet you!")
    (value (run-dovecot-test))))
 
 (define %getmail-os
-  (simple-operating-system
-   (service dhcp-client-service-type)
-   (service dovecot-service-type
-            (dovecot-configuration
-             (disable-plaintext-auth? #f)
-             (ssl? "no")
-             (auth-mechanisms '("anonymous" "plain"))
-             (auth-anonymous-username "alice")
-             (mail-location
-              (string-append "maildir:~/Maildir"
-                             ":INBOX=~/Maildir/INBOX"
-                             ":LAYOUT=fs"))))
-   (service getmail-service-type
-            (list
-             (getmail-configuration
-              (name 'test)
-              (user "alice")
-              (directory "/var/lib/getmail/alice")
-              (idle '("TESTBOX"))
-              (rcfile
-               (getmail-configuration-file
-                (retriever
-                 (getmail-retriever-configuration
-                  (type "SimpleIMAPRetriever")
-                  (server "localhost")
-                  (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))))))))))
+  (operating-system
+    (inherit (simple-operating-system))
+
+    ;; Set a password for the user account; the test needs it.
+    (users (cons (user-account
+                  (name "alice")
+                  (password (crypt "testpass" "$6$abc"))
+                  (comment "Bob's sister")
+                  (group "users")
+                  (supplementary-groups '("wheel" "audio" "video")))
+                 %base-user-accounts))
+
+    (services (cons* (service dhcp-client-service-type)
+                     (service dovecot-service-type
+                              (dovecot-configuration
+                               (disable-plaintext-auth? #f)
+                               (ssl? "no")
+                               (auth-mechanisms '("anonymous" "plain"))
+                               (auth-anonymous-username "alice")
+                               (mail-location
+                                (string-append "maildir:~/Maildir"
+                                               ":INBOX=~/Maildir/INBOX"
+                                               ":LAYOUT=fs"))))
+                     (service getmail-service-type
+                              (list
+                               (getmail-configuration
+                                (name 'test)
+                                (user "alice")
+                                (directory "/var/lib/getmail/alice")
+                                (idle '("TESTBOX"))
+                                (rcfile
+                                 (getmail-configuration-file
+                                  (retriever
+                                   (getmail-retriever-configuration
+                                    (type "SimpleIMAPRetriever")
+                                    (server "localhost")
+                                    (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)
   "Return a test of an OS running Getmail service."
@@ -483,11 +498,6 @@ Subject: Hello Nice to meet you!")
                 (start-service 'dovecot))
              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.
           (test-assert "getmail-test running"
             (marionette-eval



reply via email to

[Prev in Thread] Current Thread [Next in Thread]