[PATCH] reconfigure: Improve tests for system activation.

  • Done
  • quality assurance status badge
Details
2 participants
  • Christopher Lemmer Webber
  • Jakob L. Kreuze
Owner
unassigned
Submitted by
Jakob L. Kreuze
Severity
normal
J
J
Jakob L. Kreuze wrote on 7 Aug 2019 14:42
(address . guix-patches@gnu.org)
87r25x4059.fsf@sdf.lonestar.org
* 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(-)

Toggle diff (60 lines)
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
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl1Kx0IACgkQ9Qb9Fp2P
2VotMBAAmeGeO4/GRlk+YqPjTUIpqSdmgymQ0JbjshdjGjHR767Bb9bjCvYkFOc7
4C4OHGGaedVk2UxwCs5m68O61dWTwPN4TMWiGKYnlxtt3t6R02xtQw4rUoQ0lJ94
N25NyAXx563jqqcrHvubCCkT97JfVPSCNaRHlxjDMyEVNsfxalwLBvaRmU3zzGzv
qICgCjnaldkgrzgWsxYzYi8sB4WRaD3Rid7unxezlzEMEpE/KnY0L+u4YwII7A8Y
dfogNNfgcrmlRvyhtLxN+e0mDa/xmeY+HqMlYbJ9rmVkSg5rjqENPviYfAzVzcUu
VnRlFT2Pkz9BXMCJlUcUyCrLkuj565v9CR2zv2Cukph+8zl7NIzdeGBfeaZHFZCA
6cePiS/yLaRMxLiCPYYQJCtQeWs6G2cp+bwv7X7FcRhhB9VIQmfCpsL89qcdhMLv
7QLG6xoR+QXSpTbTZL4jl2hfQbqbzEF2CDy84p+gqdOH9pmZb8niW7coYmovhT2X
pcUCKAeCy+4g4EXxZl2YJ+NEvXhHFyFZDQYtNOW/yVAZ8S5gS/uWS16E13AhLI5I
RM9DtN7maj3mUjt5eR4GdwKo9xliUw3RmMqsNjr7MJepj4Cmyh3GTIALCPo1Mifx
TCc4BxGNqZS5UTPXFC1m/Ph5Qd02TkJyRkVophWY3xVG43qhap0=
=4wDU
-----END PGP SIGNATURE-----

C
C
Christopher Lemmer Webber wrote on 7 Aug 2019 21:34
(address . guix-patches@gnu.org)(address . 36953-done@debbugs.gnu.org)
871rxwpy6f.fsf@dustycloud.org
Jakob L. Kreuze writes:

Toggle quote (6 lines)
> + (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.
J
J
Jakob L. Kreuze wrote on 7 Aug 2019 22:44
Re: bug#36953: [PATCH] reconfigure: Improve tests for system activation.
(address . 36953@debbugs.gnu.org)(address . cwebber@dustycloud.org)
87ef1wln7d.fsf@sdf.lonestar.org
Christopher Lemmer Webber <cwebber@dustycloud.org> writes:

Toggle quote (10 lines)
> 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 ;)

Toggle quote (2 lines)
> Looks great. Merged and pushed.

Thanks!

Regards,
Jakob
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl1LOEcACgkQ9Qb9Fp2P
2VpAhw//S4DRSG8cKh6jnhxYg3dgZwBAh2bzQ06QBFic/S6rpoVtpgGPEMUIZ8nL
TD3jRNFexDlfUfS1ulf0HEAcyhsDuXhH4/InnWIwlvDQxbVxFfhRGJeGkQBmX/cv
aeABCMboyUjcRy1JYWUy+uYOfYIJP2MkztYM3X2Ojf359RFOMviMZvLjx3zMCuk8
+Wo9eplcbuiFB+0BXbtQV58xSMTUnDYuwunxB78ssZeuSiMG+X6jLpv83W+EIkAO
V80vRMnoHztoMONOIYWN7Y4A+M2VKJQ5QIpUaTX+FFekR3V4ywaRXMlUdezikQ+X
J0s8JBGklvggJJDvm9u/kNlyx+YH+EMO8qIK8qjbHjWELCGF0bk9zgf7AUdauLgy
RsBxc4+IIiyz2cfJ0kzIjh+kKD8mWZmuSlWRBt7TWg163BzRLfKpTqoiPf/RS0sd
jPI1G4oMqHPh8mdWuP2Jn6zRd0k548R+CzRKg+U9IMvmdH73JFGGqd24c2hsV33w
wNzLZ1zT9Hr+kmhwwZe3oEkfMWusIiNmfZBcQ6tXyN7/euO4H4odI2xwpw/SEEr1
BJ3+EXTDZ+7+9lbY0j9oBHrkzcDBTmQAK9BGXVEsdZMozGBv0SVD61IwW78ZGIvA
34/cpylxPzHquLVJJeXUB9FzmI1aYUK4bAEkWrJJsDzsKoYV0O0=
=Wl1s
-----END PGP SIGNATURE-----

?