[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#36555] [PATCH v4 3/3] tests: Add reconfigure system test.
From: |
Ludovic Courtès |
Subject: |
[bug#36555] [PATCH v4 3/3] tests: Add reconfigure system test. |
Date: |
Sat, 20 Jul 2019 16:50:17 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
address@hidden (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’.
- [bug#36555] [PATCH v3 0/3] Refactor out common behavior for system reconfiguration., (continued)
- [bug#36555] [PATCH v3 1/3] guix system: Add 'reconfigure' module., Ludovic Courtès, 2019/07/19
- [bug#36555] [PATCH v3 0/3] Refactor out common behavior for system reconfiguration., Jakob L. Kreuze, 2019/07/18
- [bug#36555] [PATCH v4 0/3] Refactor out common behavior for system reconfiguration., Jakob L. Kreuze, 2019/07/19
- [bug#36555] [PATCH v4 1/3] guix system: Add 'reconfigure' module., Jakob L. Kreuze, 2019/07/19
- [bug#36555] [PATCH v4 2/3] guix system: Reimplement 'reconfigure'., Jakob L. Kreuze, 2019/07/19
- [bug#36555] [PATCH v4 3/3] tests: Add reconfigure system test., Jakob L. Kreuze, 2019/07/19
- [bug#36555] [PATCH v4 3/3] tests: Add reconfigure system test.,
Ludovic Courtès <=
- [bug#36555] [PATCH v4 3/3] tests: Add reconfigure system test., Jakob L. Kreuze, 2019/07/22
- [bug#36555] [PATCH v4 3/3] tests: Add reconfigure system test., Jakob L. Kreuze, 2019/07/22
- [bug#36555] [PATCH v5 0/3] Refactor out common behavior for system reconfiguration., Jakob L. Kreuze, 2019/07/22
- [bug#36555] [PATCH v5 1/3] guix system: Add 'reconfigure' module., Jakob L. Kreuze, 2019/07/22
- [bug#36555] [PATCH v5 2/3] guix system: Reimplement 'reconfigure'., Jakob L. Kreuze, 2019/07/22
- [bug#36555] [PATCH v5 3/3] tests: Add reconfigure system test., Jakob L. Kreuze, 2019/07/22
- [bug#36555] [PATCH v5 2/3] guix system: Reimplement 'reconfigure'., Ludovic Courtès, 2019/07/23
- [bug#36555] [PATCH v5 2/3] guix system: Reimplement 'reconfigure'., Jakob L. Kreuze, 2019/07/23
- [bug#36555] [PATCH v5 2/3] guix system: Reimplement 'reconfigure'., Jakob L. Kreuze, 2019/07/23
- [bug#36555] [PATCH v6 0/3] Refactor out common behavior for system reconfiguration., Jakob L. Kreuze, 2019/07/24