Hi Konrad, Konrad Hinsen <konrad.hin...@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’.