guix-patches
[Top][All Lists]
Advanced

[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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]