all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Herman Rimm <herman@rimm.ee>
Cc: 75010@debbugs.gnu.org
Subject: [bug#75010] [PATCH 7/7] WIP: gnu: tests: Add module for guix deploy tests.
Date: Mon, 30 Dec 2024 13:21:12 +0100	[thread overview]
Message-ID: <8734i5tl8n.fsf@gnu.org> (raw)
In-Reply-To: <6438a457713360741155104b3b2c8af6fda50ee4.1734798943.git.herman@rimm.ee> (Herman Rimm's message of "Sat, 21 Dec 2024 18:04:11 +0100")

Herman Rimm <herman@rimm.ee> skribis:

> * gnu/tests/deploy.scm: Add file.
>
> Change-Id: I348c8bf2e518ec6c00af126993eaca3fcd453901

Yay, nice!

Could you add it to ‘gnu/local.mk’?

> +(define (machines os)
> +  (program-file "machines.scm"
> +    #~(list (machine (configuration

This should be ‘scheme-file’ (with normal indentation).

> +(define* (deploy-program #:optional (os #~%simple-os))
> +  (program-file "deploy.scm"
> +    (with-extensions (list guile-gcrypt)
> +      (with-imported-modules `(,@(source-module-closure
> +                                  '((guix scripts deploy))
> +                                  #:select? not-config?)
> +                               ((guix config) => ,(make-config.scm)))
> +        #~(begin
> +            (use-modules (guix scripts deploy))
> +            (guix-deploy #$(machines os)))))))

We could use the ‘guix’ package here: it would be faster, but then we
would be testing an older snapshot and not the code at hand.  Not great.

Still, maybe using ‘current-guix’ would be faster (fewer things to
build), as in:

  #~(execl #$(file-append (current-guix) "/bin/guix")
           "guix" "deploy“ #$(machines os))

> +          (define (system-generations marionette)
> +            (marionette-eval
> +             '(begin
> +                (use-modules (ice-9 ftw)
> +                             (srfi srfi-1))
> +                (let* ((profile-dir "/var/guix/profiles/")
> +                       (entries (map first (cddr (file-system-tree profile-dir)))))

Please use ‘match’ rather than ‘first’ and ‘cddr’ (info "(guix) Data
Types and Pattern Matching").

Or maybe you could just as well use ‘scandir’?

> +            (test-equal "script created new generation"
> +              (length (system-generations marionette))
> +              (1+ (length generations-prior)))
> +
> +            (test-equal "script activated the new generation"
> +              (string-append "/var/guix/profiles/system-"
> +                             (number->string (+ 1 (length generations-prior)))
> +                             "-link")
> +              (marionette-eval '(readlink "/run/current-system")
> +                               marionette)))

We could also check other things, like the host name.

Ludo’.




      reply	other threads:[~2024-12-30 12:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1734798943.git.herman@rimm.ee>
2024-12-21 17:04 ` [bug#75010] [PATCH 1/7] monads: Add 'mmatch' Herman Rimm via Guix-patches via
2024-12-30 12:34   ` Ludovic Courtès
2024-12-21 17:04 ` [bug#75010] [PATCH 2/7] gnu: machine: ssh: Refactor roll-back-managed-host Herman Rimm via Guix-patches via
2024-12-30 12:09   ` Ludovic Courtès
2024-12-21 17:04 ` [bug#75010] [PATCH 3/7] gnu: machine: ssh: Return monadic value from roll-back-managed-host Herman Rimm via Guix-patches via
2024-12-30 12:36   ` Ludovic Courtès
2024-12-21 17:04 ` [bug#75010] [PATCH 4/7] Rename two remote variables confusingly named 'generations' Herman Rimm via Guix-patches via
2024-12-21 17:04 ` [bug#75010] [PATCH 5/7] gnu: machine: Remove &deploy-error Herman Rimm via Guix-patches via
2024-12-21 17:04 ` [bug#75010] [PATCH 6/7] gnu: machine: ssh: Roll-back on failure Herman Rimm via Guix-patches via
2024-12-21 17:04 ` [bug#75010] [PATCH 7/7] WIP: gnu: tests: Add module for guix deploy tests Herman Rimm via Guix-patches via
2024-12-30 12:21   ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734i5tl8n.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=75010@debbugs.gnu.org \
    --cc=herman@rimm.ee \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.