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)))))
a9f6c72196fb8e'>Merge branch 'master' into core-updates...Marius Bakke 2020-04-29tests: install: Fix device usage....Mathieu Othacehe 2020-04-29tests: install: Fix gui-installed-os test....Mathieu Othacehe 2020-04-29tests: install: Increase virtual machine RAM....Mathieu Othacehe 2020-04-26tests: Add 'guile-final' to the installation test GC roots....Marius Bakke 2020-04-10tests: Run guided installation tests from an ISO image....Ludovic Courtès 2020-04-08tests: Mark VM images as non-substitutable....Ludovic Courtès 2020-03-26tests: install: Add %test-gui-installed-desktop-os-encrypted....Mathieu Othacehe 2020-03-22tests: install: Abort when one installation step fails....Mathieu Othacehe 2020-03-19tests: Accept manual installation scripts that exit with SIGTERM....Ludovic Courtès 2020-03-05tests: install: Add %test-gui-installed-os-encrypted....Mathieu Othacehe 2020-03-05tests: install: Add "gui-installed-os"....Ludovic Courtès 2020-02-22tests: Factorize LUKS passphrase....Ludovic Courtès 2020-01-19tests: install: "raid-root-os" test uses RAID-1 instead of RAID-0....Ludovic Courtès 2020-01-03tests: install: Test a JFS root file system....Tobias Geerinckx-Rice 2019-11-18tests: install: Fix typo....Maxim Cournoyer 2019-11-06tests: install: Increase root partition size....Ludovic Courtès 2019-07-06tests: encrypted-root-os: Increase root partition size....Ludovic Courtès 2019-06-24tests: Import (guix build utils) in the marionette....Ludovic Courtès 2019-05-15system: Add 'operating-system-with-gc-roots'....Ludovic Courtès 2019-04-14tests: separate-store-os: Increase root partition size....Ludovic Courtès 2019-03-25accounts: Add default value for the 'home-directory' field of <user-account>....Ludovic Courtès 2019-03-13Remove traces of "GuixSD"....Ludovic Courtès