GNU bug report logs -
#36555
[PATCH 0/2] Refactor out common behavior for system reconfiguration.
Previous Next
Full log
Message #95 received at 36555 <at> debbugs.gnu.org (full text, mbox):
zerodaysfordays <at> sdf.lonestar.org (Jakob L. Kreuze) skribis:
> * gnu/tests/reconfigure.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
That’s really cool!
> + (test-begin "switch-to-system")
> +
> + (let ((generations-prior (system-generations marionette)))
> + (test-assert "script successfully evaluated"
> + (marionette-eval
> + '(primitive-load #$script)
> + marionette))
> +
> + (test-equal "script created new generation"
> + (length (system-generations marionette))
> + (1+ (length generations-prior))))
Perhaps you could also check the target of /run/current-system, and
maybe check things like the set of user accounts (activation code)?
> +(define* (run-upgrade-services-test)
> + "Run a test of an OS running UPGRADE-SERVICES-PROGRAM, which upgrades the
> +Shepherd (PID 1) by unloading obsolete services and loading new services."
> + (define os
> + (marionette-operating-system
> + (simple-operating-system)
> + #:imported-modules '((gnu services herd)
> + (guix combinators))))
> +
> + (define vm (virtual-machine os))
> +
> + (define dummy-service
> + ;; Shepherd service that does nothing, for the sole purpose of ensuring
> + ;; that it is properly installed and started by the script.
> + (shepherd-service (provision '(dummy))
> + (start #~(const #t))
> + (stop #~(const #t))
> + (respawn? #f)))
> +
> + (define (ensure-service-file service)
> + "Return the Shepherd service file for SERVICE, after ensuring that it
> +exists in the store"
No need for docstrings for inner procedures; a comment is enough.
> + (test-assert "script started new service"
> + (and (not (memq 'dummy services-prior))
> + (memq 'dummy (running-services marionette))))
> +
> + (test-assert "script successfully evaluated"
> + (marionette-eval
> + '(primitive-load #$disable-dummy)
> + marionette))
> +
> + (test-assert "script stopped new service"
^
s/new/obsolete/, no?
Perhaps you could also check for the availability of a “replacement”
slot (info "(shepherd) Slots of services") for services that exist both
before and after the upgrade? This could be achieved by augmenting (gnu
services herd) with a ‘live-service-replacement’ procedure, I think.
The rest LGTM!
I think you’ve reached the most difficult part of this whole endeavor.
The good thing is that, once you’re past this, things will be much
easier.
Thank you!
Ludo’.
This bug report was last modified 5 years and 272 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.