diff options
author | Ludovic Courtès <ludo@gnu.org> | 2025-02-23 15:20:41 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-03-05 00:28:49 +0100 |
commit | 749eb1a2dd9fdf63a71f223b3f6756d9cb5940e6 (patch) | |
tree | 0334ba964679d4cc87110ead1fc3af7c14bf7131 /tests | |
parent | c92fbc83d4d2a98cc15e10d1fc4d5bcc13c9af5b (diff) |
services: ‘shepherd-service-upgrade’ handles canonical name changes.
Partly fixes <https://issues.guix.gnu.org/76315>.
Fixes a bug whereby a service whose canonical name has changed would not
be restarted—e.g., if '(syslogd) has a replacement providing
'(system-log syslogd).
* gnu/services/shepherd.scm (shepherd-service-upgrade)[running?]:
Remove.
[to-restart]: Change to a subset of LIVE. Look up all the names of each
element of TARGET.
* guix/scripts/system/reconfigure.scm (upgrade-shepherd-services):
TO-RESTART is now a list of <live-service>; adjust accordingly.
* tests/services.scm ("shepherd-service-upgrade: one unchanged, one upgraded, one new"):
("shepherd-service-upgrade: service depended on is not unloaded"):
("shepherd-service-upgrade: obsolete services that depend on each other"):
("shepherd-service-upgrade: transient service"): Adjust accordingly.
("shepherd-service-upgrade: service has new canonical name"): New test.
Reported-by: Tomas Volf <~@wolfsden.cz>
Change-Id: I7cec495b4e824da5fad5518f039607cf92f935d9
Diffstat (limited to 'tests')
-rw-r--r-- | tests/services.scm | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/tests/services.scm b/tests/services.scm index 98b584f6c0..993283047f 100644 --- a/tests/services.scm +++ b/tests/services.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015-2019, 2022, 2023 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015-2019, 2022-2023, 2025 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -225,7 +225,7 @@ (start #t))))) (lambda (unload restart) (list (map live-service-provision unload) - (map shepherd-service-provision restart))))) + (map live-service-provision restart))))) (test-equal "shepherd-service-upgrade: service depended on is not unloaded" '(((baz)) ;unload @@ -243,7 +243,7 @@ (start #t))))) (lambda (unload restart) (list (map live-service-provision unload) - (map shepherd-service-provision restart))))) + (map live-service-provision restart))))) (test-equal "shepherd-service-upgrade: obsolete services that depend on each other" '(((foo) (bar) (baz)) ;unload @@ -260,7 +260,7 @@ (start #t))))) (lambda (unload restart) (list (map live-service-provision unload) - (map shepherd-service-provision restart))))) + (map live-service-provision restart))))) (test-equal "shepherd-service-upgrade: transient service" ;; Transient service must not be unloaded: @@ -277,7 +277,24 @@ (start #t))))) (lambda (unload restart) (list (map live-service-provision unload) - (map shepherd-service-provision restart))))) + (map live-service-provision restart))))) + +(test-equal "shepherd-service-upgrade: service has new canonical name" + '(((qux)) ;unload + ((ssh) (foo))) ;restart + (call-with-values + (lambda () + (shepherd-service-upgrade + (list (live-service '(ssh) '() #f 42) ;running + (live-service '(foo) '() #f #t) ;changed canonical name + (live-service '(qux) '() #f #t)) ;obsolete + (list (shepherd-service (provision '(ssh)) + (start #t)) + (shepherd-service (provision '(bar foo)) + (start #t))))) + (lambda (unload restart) + (list (map live-service-provision unload) + (map live-service-provision restart))))) (test-eq "lookup-service-types" system-service-type |