unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#36953] [PATCH] reconfigure: Improve tests for system activation.
@ 2019-08-07 12:42 Jakob L. Kreuze
  2019-08-07 19:34 ` bug#36953: " Christopher Lemmer Webber
  0 siblings, 1 reply; 3+ messages in thread
From: Jakob L. Kreuze @ 2019-08-07 12:42 UTC (permalink / raw)
  To: 36953

[-- Attachment #1: Type: text/plain, Size: 2631 bytes --]

* 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.
---
 gnu/tests/reconfigure.scm | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm
index 3a2f0a2e53..fb11e6164e 100644
--- a/gnu/tests/reconfigure.scm
+++ b/gnu/tests/reconfigure.scm
@@ -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 @@
 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 @@ generation of the system profile."
 
             (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)))))
-- 
2.22.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#36953: [PATCH] reconfigure: Improve tests for system activation.
  2019-08-07 12:42 [bug#36953] [PATCH] reconfigure: Improve tests for system activation Jakob L. Kreuze
@ 2019-08-07 19:34 ` Christopher Lemmer Webber
  2019-08-07 20:44   ` [bug#36953] " Jakob L. Kreuze
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Lemmer Webber @ 2019-08-07 19:34 UTC (permalink / raw)
  To: guix-patches; +Cc: 36953-done

Jakob L. Kreuze writes:

> +       (users (cons (user-account
> +                     (name "jakob")
> +                     (group "users")
> +                     (home-directory "/home/jakob"))
> +                    %base-user-accounts)))

Welcome to the test machine, jakob ;)

Looks great.  Merged and pushed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#36953] [PATCH] reconfigure: Improve tests for system activation.
  2019-08-07 19:34 ` bug#36953: " Christopher Lemmer Webber
@ 2019-08-07 20:44   ` Jakob L. Kreuze
  0 siblings, 0 replies; 3+ messages in thread
From: Jakob L. Kreuze @ 2019-08-07 20:44 UTC (permalink / raw)
  To: 36953

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]

Christopher Lemmer Webber <cwebber@dustycloud.org> writes:

> Jakob L. Kreuze writes:
>
>> +       (users (cons (user-account
>> +                     (name "jakob")
>> +                     (group "users")
>> +                     (home-directory "/home/jakob"))
>> +                    %base-user-accounts)))
>
> Welcome to the test machine, jakob ;)

Heh, I'm pretty bad at coming up with names for examples. Maybe I should
take inspiration from you and use Eva Lu Ator or Alyssa P. Hacker next
time the need arises ;)

> Looks great.  Merged and pushed.

Thanks!

Regards,
Jakob

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-07 20:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 12:42 [bug#36953] [PATCH] reconfigure: Improve tests for system activation Jakob L. Kreuze
2019-08-07 19:34 ` bug#36953: " Christopher Lemmer Webber
2019-08-07 20:44   ` [bug#36953] " Jakob L. Kreuze

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).