mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
reconfigure: Improve tests for system activation.
* gnu/tests/reconfigure.scm (run-switch-to-system-test): Assert that '/run/current-system' points to the activated system, and that new user accounts specified in the operating system declaration are created.
This commit is contained in:
parent
355ba48c46
commit
ec12235ce2
1 changed files with 29 additions and 3 deletions
|
@ -19,8 +19,10 @@
|
|||
(define-module (gnu tests reconfigure)
|
||||
#:use-module (gnu bootloader)
|
||||
#:use-module (gnu services shepherd)
|
||||
#:use-module (gnu system vm)
|
||||
#:use-module (gnu system)
|
||||
#:use-module (gnu system accounts)
|
||||
#:use-module (gnu system shadow)
|
||||
#:use-module (gnu system vm)
|
||||
#:use-module (gnu tests)
|
||||
#:use-module (guix derivations)
|
||||
#:use-module (guix gexp)
|
||||
|
@ -43,7 +45,13 @@ (define* (run-switch-to-system-test)
|
|||
generation of the system profile."
|
||||
(define os
|
||||
(marionette-operating-system
|
||||
(simple-operating-system)
|
||||
(operating-system
|
||||
(inherit (simple-operating-system))
|
||||
(users (cons (user-account
|
||||
(name "jakob")
|
||||
(group "users")
|
||||
(home-directory "/home/jakob"))
|
||||
%base-user-accounts)))
|
||||
#:imported-modules '((gnu services herd)
|
||||
(guix combinators))))
|
||||
|
||||
|
@ -84,7 +92,25 @@ (define (system-generations marionette)
|
|||
|
||||
(test-equal "script created new generation"
|
||||
(length (system-generations marionette))
|
||||
(1+ (length generations-prior))))
|
||||
(1+ (length generations-prior)))
|
||||
|
||||
(test-assert "script activated the new generation"
|
||||
(and (eqv? 'symlink
|
||||
(marionette-eval
|
||||
'(stat:type (lstat "/run/current-system"))
|
||||
marionette))
|
||||
(string= #$os
|
||||
(marionette-eval
|
||||
'(readlink "/run/current-system")
|
||||
marionette))))
|
||||
|
||||
(test-assert "script activated user accounts"
|
||||
(marionette-eval
|
||||
'(string-contains (call-with-input-file "/etc/passwd"
|
||||
(lambda (port)
|
||||
(get-string-all port)))
|
||||
"jakob")
|
||||
marionette)))
|
||||
|
||||
(test-end)
|
||||
(exit (= (test-runner-fail-count (test-runner-current)) 0)))))
|
||||
|
|
Loading…
Reference in a new issue