aboutsummaryrefslogtreecommitdiff
path: root/tests/ipfs.scm
blob: 3b662b22bd9b00b2cbd6355897c2055fab846195 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-ipfs)
  #:use-module (guix ipfs)
  #:use-module ((guix utils) #:select (call-with-temporary-directory))
  #:use-module (guix tests)
  #:use-module (web uri)
  #:use-module (srfi srfi-64))

;; Test the (guix ipfs) module.

(define (ipfs-gateway-running?)
  "Return true if the IPFS gateway is running at %IPFS-BASE-URL."
  (let* ((uri    (string->uri (%ipfs-base-url)))
         (socket (socket AF_INET SOCK_STREAM 0)))
    (define connected?
      (catch 'system-error
        (lambda ()
          (format (current-error-port)
                  "probing IPFS gateway at localhost:~a...~%"
                  (uri-port uri))
          (connect socket AF_INET INADDR_LOOPBACK (uri-port uri))
          #t)
        (const #f)))

    (close-port socket)
    connected?))

(unless (ipfs-gateway-running?)
  (test-skip 1))

(test-assert "add-file-tree + restore-file-tree"
  (call-with-temporary-directory
   (lambda (directory)
     (let* ((source  (dirname (search-path %load-path "guix/base32.scm")))
            (target  (string-append directory "/r"))
            (content (pk 'content (add-file-tree source))))
       (restore-file-tree (content-name content) target)
       (file=? source target)))))
ix/commit/nix?id=82b06436b4b563a85e70f3fcc610959482f08e91'>daemon: Clarify ‘--check’ error when outputs are missing....Tobias Geerinckx-Rice 2022-05-18daemon: runChild() is forbidden to talk during environment set up...yarl-baudig@mailoo.org 2022-04-14daemon: Support systemd-style socket activation....Ludovic Courtès 2022-01-18daemon: Always default to gzip for log compression....Ludovic Courtès 2021-11-27daemon: Print the line whence we expect an integer....Tobias Geerinckx-Rice 2021-11-25daemon: Read substitute nar size as 'unsigned long long'....Ludovic Courtès 2021-11-25daemon: Read unsigned nar size and download size from substituter....Ludovic Courtès 2021-11-19daemon: Micro-optimize 'deletePath'....Ludovic Courtès 2021-11-16daemon: Do not deduplicate files smaller than 8 KiB....Ludovic Courtès 2021-10-01build: Don’t delete ‘guix-gc.timer’ file....Xinglu Chen 2021-09-20etc: Add systemd files for running ‘guix gc’ periodically...Thiago Jung Bauermann 2021-04-09daemon: 'guix substitute' replies on FD 4....Ludovic Courtès 2021-04-03daemon: Remove dead code....Ludovic Courtès 2021-03-30gnu: guix: Fix openrc init scripts....zimoun 2021-03-18daemon: Prevent privilege escalation with '--keep-failed' [security]....Ludovic Courtès 2021-03-17daemon: Correctly handle '--discover' with no value....Ludovic Courtès 2020-12-19daemon: Delegate deduplication to 'guix substitute'....Ludovic Courtès 2020-12-19daemon: Do not reset timestamps and permissions on substituted items....Ludovic Courtès 2020-12-19daemon: Let 'guix substitute' perform hash checks....Ludovic Courtès 2020-12-08daemon: Raise an error if substituter doesn't send the expected hash....Ludovic Courtès 2020-12-08substitute: Cache and reuse connections while substituting....Ludovic Courtès 2020-12-08daemon: Run 'guix substitute --substitute' as an agent....Ludovic Courtès 2020-12-08daemon: Factorize substituter agent spawning....Ludovic Courtès 2020-12-08daemon: Use 'Agent' to spawn 'guix substitute --query'....Ludovic Courtès 2020-12-08daemon: 'Agent' constructor takes a list of environment variables....Ludovic Courtès 2020-12-01daemon: Remove unneeded forward declaration....Ludovic Courtès 2020-11-29daemon: Remove pre-Guix hack....Ludovic Courtès 2020-11-29Use substitute servers on the local network....Mathieu Othacehe