unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 45905@debbugs.gnu.org
Subject: [bug#45905] [PATCH] IPFS service definition
Date: Mon, 29 Mar 2021 16:06:40 +0200	[thread overview]
Message-ID: <878s66oxzj.fsf@gnu.org> (raw)
In-Reply-To: <4e1df2f011f5766d48c44d7231e562a889239e7a.camel@telenet.be> (Maxime Devos's message of "Sun, 28 Mar 2021 18:36:13 +0200")

Hi Maxime,

Maxime Devos <maximedevos@telenet.be> skribis:

> TODO: this test isn't run for some reason:
>
> $ make && make check-system TESTS="ipfs"
>> [compilation bla bla]
>> Compiling Scheme modules...
>> Selected 1 system tests...
>> (end of output)
>
> ??? why isn't the IPFS test executed?

[...]

> +(define (run-ipfs-test)
> +  (define os
> +    (marionette-operating-system %ipfs-os
> +                                 #:imported-modules '((gnu services herd)
> +                                                      (guix ipfs))
> +                                 #:requirements '(ipfs)))
> +
> +  (define test
> +    (with-imported-modules '((gnu build marionette))
> +      #~(begin
> +          (use-modules (gnu build marionette)
> +                       (srfi srfi-64))
> +
> +          (define marionette
> +            (make-marionette (list #$(virtual-machine os))))
> +
> +          (define (ipfs-is-alive?)
> +            (marionette-eval
> +             '(begin
> +                (use-modules (gnu services herd)
> +                             (srfi srfi-1))
> +                (live-service-running
> +                 (find (lambda (live)
> +                         (memq 'ipfs
> +                               (live-service-provision live)))
> +                       (current-services))))
> +             marionette))
> +
> +          ;; The default API endpoint port 5001 is used,
> +          ;; so there is no need to parameterize %ipfs-base-url.
> +          ;; By running this within the VM instead of outside the VM
> +          ;; this system test does not have to forward any ports. 
> +          (define (add-data data)
> +            (marionette-eval
> +             `((@ (guix ipfs) add-contents) ,data)))
> +          (define (read-contents object)
> +            (marionette-eval
> +             `((@ (guix ipfs) read-contents) ,object)))
> +
> +          (test-begin "ipfs")

[...]

> +  (gexp->derivation "ipfs-test" test))

You need to add:

  (mkdir #$output)
  (chdir #$output)

right before (test-begin "ipfs").

Failing to do that, you create “ipfs-test.drv” as a zero-output
derivation—i.e., a derivation that doesn’t produce any output.  Since it
produces nothing, the daemon doesn’t bother running its code.

Nitpick: please avoid ‘@’.  Instead, explicitly do:

  (marionette-eval '(use-modules (ipfs)) marionette)

Alternatively, you can arrange to set up port forwarding for the VM and
use the (ipfs) module from the host rather than from the guest.  This is
what (gnu tests ssh) does, for example.

As it stands, the test fails because you need to:

  (define test
    (with-extensions (list guile-json)
      …))

so that Guile-JSON is available, and probably also:

  (with-imported-modules '((ipfs))
    …)

The rest LGTM.

HTH!

Ludo’.




  reply	other threads:[~2021-03-29 14:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 21:22 [bug#45905] [PATCH] IPFS service definition Maxime Devos
2021-03-22 17:17 ` Ludovic Courtès
2021-03-22 18:40   ` Maxime Devos
2021-03-23 13:08     ` Ludovic Courtès
2021-03-28 16:36       ` Maxime Devos
2021-03-29 14:06         ` Ludovic Courtès [this message]
2021-03-29 14:07         ` Ludovic Courtès
2021-03-30 13:37 ` [bug#45905] [PATCH v3] " Maxime Devos
2021-04-12 16:48   ` bug#45905: [PATCH] " Ludovic Courtès
2021-04-12 18:35     ` [bug#45905] " Maxime Devos

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=878s66oxzj.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=45905@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /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).