| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 |
|
| 19 | (define-module (tests services pam-mount)
|
| 20 | #:use-module (gnu services pam-mount)
|
| 21 | #:use-module (gnu system pam)
|
| 22 | #:use-module (gnu services)
|
| 23 | #:use-module (gnu services configuration)
|
| 24 | #:use-module (guix derivations)
|
| 25 | #:use-module (guix gexp)
|
| 26 | #:use-module (guix grafts)
|
| 27 | #:use-module (guix store)
|
| 28 | #:use-module (guix tests)
|
| 29 | #:use-module (ice-9 match)
|
| 30 | #:use-module (srfi srfi-1)
|
| 31 | #:use-module (srfi srfi-64))
|
| 32 |
|
| 33 | (define pam-mount-volume-fields (@@ (gnu services pam-mount)
|
| 34 | pam-mount-volume-fields))
|
| 35 | (define field-name->tag (@@ (gnu services pam-mount)
|
| 36 | field-name->tag))
|
| 37 |
|
| 38 | (define pam-mount-volume->sxml (@@ (gnu services pam-mount)
|
| 39 | pam-mount-volume->sxml))
|
| 40 |
|
| 41 | (test-begin "services-pam-mount")
|
| 42 |
|
| 43 | (test-group "field-name->tag"
|
| 44 | (let ((field-map '((user-name user)
|
| 45 | (user-id uid)
|
| 46 | (primary-group pgrp)
|
| 47 | (group-id gid)
|
| 48 | (secondary-group sgrp)
|
| 49 | (file-system-type fstype)
|
| 50 | (no-mount-as-root? noroot)
|
| 51 | (server server)
|
| 52 | (file-name path)
|
| 53 | (mount-point mountpoint)
|
| 54 | (options options)
|
| 55 | (ssh? ssh)
|
| 56 | (cipher cipher)
|
| 57 | (file-system-key-cipher fskeycipher)
|
| 58 | (file-system-key-hash fskeyhash)
|
| 59 | (file-system-key-file-name fskeypath))))
|
| 60 |
|
| 61 | (test-equal "all fields accounted for"
|
| 62 | (map car field-map)
|
| 63 | (map configuration-field-name pam-mount-volume-fields))
|
| 64 |
|
| 65 | (for-each (match-lambda
|
| 66 | ((field-name tag-name)
|
| 67 | (test-eq (format #f "~a -> ~a" field-name tag-name)
|
| 68 | (field-name->tag field-name) tag-name)))
|
| 69 | field-map)))
|
| 70 |
|
| 71 | (let ((tmpfs-volume (pam-mount-volume
|
| 72 | (secondary-group "users")
|
| 73 | (file-system-type "tmpfs")
|
| 74 | (mount-point "/run/user/%(USERUID)")
|
| 75 | (options "someoptions"))))
|
| 76 | (test-equal "tmpfs"
|
| 77 | '(volume (@ (sgrp "users")
|
| 78 | (fstype "tmpfs")
|
| 79 | (mountpoint "/run/user/%(USERUID)")
|
| 80 | (options "someoptions")))
|
| 81 | (pam-mount-volume->sxml tmpfs-volume)))
|
| 82 |
|
| 83 | (test-end "services-pam-mount")
|