unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Giacomo Leidi <goodoldpaul@autistici.org>
Cc: 67613@debbugs.gnu.org
Subject: [bug#67613] Introduce unit tests for oci-container-service-type.
Date: Sun, 10 Dec 2023 22:47:01 +0100	[thread overview]
Message-ID: <87lea13f3e.fsf_-_@gnu.org> (raw)
In-Reply-To: <20231203215630.28144-1-goodoldpaul@autistici.org> (Giacomo Leidi's message of "Sun, 3 Dec 2023 22:56:28 +0100")

Hello,

Giacomo Leidi <goodoldpaul@autistici.org> skribis:

> This patch is a followup to issue #66160 and issue #67574. It introduces
> unit tests for the oci-container-service-type. 8 out 11 tests depend on
> issue #67574 being merged since issue #66160 was merged with a blocking
> bug from the beginning.
>
> * gnu/services/docker.scm: Export
> oci-container-configuration-container-user and
> oci-container-configuration-workdir.
> * tests/services/docker.scm: New file.
> * Makefile.am (SCM_TESTS): Register it.
>
> Change-Id: I47ed0fe36060ba84dd50b548a66f36e3df8a3710

Thanks for working on this!

To me, what’s really helpful is a system test: a test that spins up a VM
running an OCI service and makes sure said service is functional.
Apologies if I wasn’t clear!

Unit tests can be interesting too, but only if their “bug-finding
performance” is good.  The tests below, for instance, are likely to be
mirroring the implementation too closely to be really able to find bugs:

> +  (test-equal "environment"
> +    (list "--env" '(string-append "key" "=" "value")
> +          "--env" '(string-append "environment" "=" "variable"))
> +    (oci-container-configuration->options
> +     (oci-container-configuration
> +      (inherit config)
> +      (environment
> +       '(("key" . "value")
> +         ("environment" . "variable"))))))
> +
> +  (test-equal "network"
> +    (list "--network" "host")
> +    (oci-container-configuration->options
> +     (oci-container-configuration
> +      (inherit config)
> +      (network "host"))))
> +
> +  (test-equal "container-user"
> +    (list "--user" "service-account")
> +    (oci-container-configuration->options
> +     (oci-container-configuration
> +      (inherit config)
> +      (container-user "service-account"))))

Thus my suggestion would be to instead focus on a system test, like
those in (gnu tests docker).

Does that make sense?  WDYT?

Ludo’.




  reply	other threads:[~2023-12-10 21:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 21:53 [bug#67613] Introduce unit tests for oci-container-service-type paul via Guix-patches via
2023-12-03 21:56 ` [bug#67613] [PATCH] tests: Add oci-container-service-type unit tests Giacomo Leidi via Guix-patches via
2023-12-10 21:47   ` Ludovic Courtès [this message]
2023-12-10 22:10     ` [bug#67613] Introduce unit tests for oci-container-service-type paul via Guix-patches via
2023-12-14 18:34       ` Ludovic Courtès
2024-01-11 20:39         ` paul via Guix-patches via
2024-05-03 22:10           ` paul via Guix-patches via
2024-01-11 20:39 ` [bug#67613] [PATCH v2 1/5] gnu: docker: Provide escape hatch in oci-container-configuration Giacomo Leidi via Guix-patches via
2024-01-11 20:39   ` [bug#67613] [PATCH v2 2/5] gnu: docker: Allow setting host environment variables " Giacomo Leidi via Guix-patches via
2024-01-11 20:39   ` [bug#67613] [PATCH v2 3/5] gnu: docker: Allow setting Shepherd dependencies " Giacomo Leidi via Guix-patches via
2024-01-11 20:39   ` [bug#67613] [PATCH v2 4/5] gnu: docker: Allow passing tarballs for images " Giacomo Leidi via Guix-patches via
2024-01-11 20:39   ` [bug#67613] [PATCH v2 5/5] gnu: Add tests and documentation for oci-container-service-type Giacomo Leidi via Guix-patches via
2024-05-03 22:11 ` [bug#67613] [PATCH v3 1/5] gnu: docker: Provide escape hatch in oci-container-configuration Giacomo Leidi via Guix-patches via
2024-05-03 22:11   ` [bug#67613] [PATCH v3 2/5] gnu: docker: Allow setting host environment variables " Giacomo Leidi via Guix-patches via
2024-05-03 22:11   ` [bug#67613] [PATCH v3 3/5] gnu: docker: Allow setting Shepherd dependencies " Giacomo Leidi via Guix-patches via
2024-05-03 22:11   ` [bug#67613] [PATCH v3 4/5] gnu: docker: Allow passing tarballs for images " Giacomo Leidi via Guix-patches via
2024-05-03 22:11   ` [bug#67613] [PATCH v3 5/5] gnu: Add tests for oci-container-service-type Giacomo Leidi via Guix-patches via
2024-05-25 13:58   ` bug#67613: Introduce unit " Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87lea13f3e.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=67613@debbugs.gnu.org \
    --cc=goodoldpaul@autistici.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).