unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Konrad Hinsen <konrad.hinsen@fastmail.net>
Cc: 47239@debbugs.gnu.org
Subject: bug#47239: Test failure in tests/publish.scm with commit 1955ef93b76e51cab5bed4c90f7eb9df7035355a
Date: Sat, 20 Mar 2021 21:41:08 +0100	[thread overview]
Message-ID: <87zgyx4kyj.fsf@gnu.org> (raw)
In-Reply-To: <m1sg4smria.fsf@ordinateur-de-catherine--konrad.home> (Konrad Hinsen's message of "Thu, 18 Mar 2021 16:05:33 +0100")

Hi Konrad,

Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:

> test-name: with cache
> location: /home/hinsen/src/guix/tests/publish.scm:417
> source:
> + (test-equal
> +   "with cache"
> +   (list #t
> +         `(("StorePath" unquote %item)
> +           ("URL"
> +            unquote
> +            (string-append "nar/gzip/" (basename %item)))
> +           ("Compression" . "gzip"))
> +         200
> +         #t
> +         #t
> +         404)
> +   (call-with-temporary-directory
> +     (lambda (cache)
> +       (let ((thread
> +               (with-separate-output-ports
> +                 (call-with-new-thread
> +                   (lambda ()
> +                     (guix-publish
> +                       "--port=6797"
> +                       "-C2"
> +                       (string-append "--cache=" cache)
> +                       "--cache-bypass-threshold=0"))))))
> +         (wait-until-ready 6797)
> +         (let* ((base "http://localhost:6797/")
> +                (part (store-path-hash-part %item))
> +                (url (string-append base part ".narinfo"))
> +                (nar-url
> +                  (string-append base "nar/gzip/" (basename %item)))
> +                (cached
> +                  (string-append
> +                    cache
> +                    "/gzip/"
> +                    (basename %item)
> +                    ".narinfo"))
> +                (nar (string-append
> +                       cache
> +                       "/gzip/"
> +                       (basename %item)
> +                       ".nar"))
> +                (response (http-get url)))
> +           (and (= 404 (response-code response))
> +                (match (assq-ref
> +                         (response-headers response)
> +                         'cache-control)
> +                       ((((quote max-age) . ttl)) (< ttl 3600)))
> +                (wait-for-file cached)
> +                (= 420 (stat:perms (lstat cached)))
> +                (= 420 (stat:perms (lstat nar)))
> +                (let* ((body (http-get-port url))
> +                       (compressed (http-get nar-url))
> +                       (uncompressed
> +                         (http-get
> +                           (string-append base "nar/" (basename %item))))
> +                       (narinfo (recutils->alist body)))
> +                  (list (file-exists? nar)
> +                        (filter
> +                          (lambda (item)
> +                            (match item
> +                                   (("Compression" . _) #t)
> +                                   (("StorePath" . _) #t)
> +                                   (("URL" . _) #t)
> +                                   (_ #f)))
> +                          narinfo)
> +                        (response-code compressed)
> +                        (= (response-content-length compressed)
> +                           (stat:size (stat nar)))
> +                        (= (string->number (assoc-ref narinfo "FileSize"))
> +                           (stat:size (stat nar)))
> +                        (response-code uncompressed)))))))))
> expected-value: (#t (("StorePath" . "/home/hinsen/src/guix/test-tmp/store/892j9b0gqgbj4a7sv40jif3yyv25sm90-item") ("URL" . "nar/gzip/892j9b0gqgbj4a7sv40jif3yyv25sm90-item") ("Compression" . "gzip")) 200 #t #t 404)
> actual-value: #f
> result: FAIL

Is it reproducible?  (You can run “make check TESTS=tests/publish.scm”.)

If it is, could you add ‘pk’ calls here and there to see which of the
sub-expressions in (and …) returns false?

For example, replace:

  (= 404 (response-code response)

by:

  (pk 'four-oh-four (= 404 (response-code response)))

That’ll print a line in the test log with the value of that (= …)
expression.

TIA,
Ludo’.




  reply	other threads:[~2021-03-20 20:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 15:05 bug#47239: Test failure in tests/publish.scm with commit 1955ef93b76e51cab5bed4c90f7eb9df7035355a Konrad Hinsen
2021-03-20 20:41 ` Ludovic Courtès [this message]
2021-03-21 10:26   ` Konrad Hinsen
2021-03-21 14:25     ` zimoun
2021-03-22  7:54       ` Konrad Hinsen
2021-03-22 16:04 ` Cees de Groot
2021-03-24  2:32 ` Cees de Groot
2021-03-31 14:02   ` 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=87zgyx4kyj.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=47239@debbugs.gnu.org \
    --cc=konrad.hinsen@fastmail.net \
    /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).