From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:34157) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoqhT-0000bg-Vh for guix-patches@gnu.org; Sat, 20 Jul 2019 10:51:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoqhR-0000l8-Ur for guix-patches@gnu.org; Sat, 20 Jul 2019 10:51:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48930) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hoqhR-0000l3-RA for guix-patches@gnu.org; Sat, 20 Jul 2019 10:51:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hoqhR-0005Vc-NZ for guix-patches@gnu.org; Sat, 20 Jul 2019 10:51:01 -0400 Subject: [bug#36555] [PATCH v4 3/3] tests: Add reconfigure system test. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87imsci9sj.fsf@sdf.lonestar.org> <87ef30i9fl.fsf@sdf.lonestar.org> <87y3129qsn.fsf@gnu.org> <87sgr9bziq.fsf@sdf.lonestar.org> <87pnmc7nt1.fsf@gnu.org> <8736j7nwcb.fsf@sdf.lonestar.org> <87muhfjm14.fsf@gnu.org> <87ftn63l7d.fsf@sdf.lonestar.org> <87v9w1zgon.fsf_-_@sdf.lonestar.org> <87y30v3qke.fsf@sdf.lonestar.org> <871rylrjt8.fsf_-_@sdf.lonestar.org> <87wogdq575.fsf_-_@sdf.lonestar.org> <87r26lq531.fsf_-_@sdf.lonestar.org> <87muh9q51e.fsf_-_@sdf.lonestar.org> Date: Sat, 20 Jul 2019 16:50:17 +0200 In-Reply-To: <87muh9q51e.fsf_-_@sdf.lonestar.org> (Jakob L. Kreuze's message of "Fri, 19 Jul 2019 13:59:25 -0400") Message-ID: <87wogc4v6e.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: "Jakob L. Kreuze" Cc: 36555@debbugs.gnu.org zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) skribis: > * gnu/tests/reconfigure.scm: New file. > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. That=E2=80=99s 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 ensur= ing > + ;; 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 =E2=80=9Creplacement= =E2=80=9D 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 =E2=80=98live-service-replacement=E2=80=99 procedure,= I think. The rest LGTM! I think you=E2=80=99ve reached the most difficult part of this whole endeav= or. The good thing is that, once you=E2=80=99re past this, things will be much easier. Thank you! Ludo=E2=80=99.