unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 9c6fa65df65f090d3538ec1bc595229d10fc4134 2792 bytes (raw)
name: tests/services/vpn.scm 	 # note: path name is non-authoritative(*)

 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; 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 (tests services vpn)
  #:use-module (gnu packages vpn)
  #:use-module (gnu services vpn)
  #:use-module (guix gexp)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-64))

;;; Commentary:
;;;
;;; Unit tests for the (gnu services vpn) module.
;;;
;;; Code:

;;; Access some internals for whitebox testing.
(define ipv4-address? (@@ (gnu services vpn) ipv4-address?))
(define ipv6-address? (@@ (gnu services vpn) ipv6-address?))
(define host-name? (@@ (gnu services vpn) host-name?))
(define peers->endpoint-host-names
  (@@ (gnu services vpn) peers->endpoint-host-names))

(test-begin "vpn-services")

(test-assert "ipv4-address?"
  (every ipv4-address?
         (list "192.95.5.67:1234"
               "10.0.0.1")))

(test-assert "ipv6-address?"
  (every ipv6-address?
         (list "[2607:5300:60:6b0::c05f:543]:2468"
               "2607:5300:60:6b0::c05f:543"
               "2345:0425:2CA1:0000:0000:0567:5673:23b5"
               "2345:0425:2CA1::0567:5673:23b5")))

(define %wireguard-peers
  (list (wireguard-peer
         (name "dummy1")
         (public-key "VlesLiEB5BFd//OD2ILKXviolfz+hodG6uZ+XjoalC8=")
         (endpoint "some.dynamic-dns.service:53281")
         (allowed-ips '()))
        (wireguard-peer
         (name "dummy2")
         (public-key "AlesLiEB5BFd//OD2ILKXviolfz+hodG6uZ+XgoalC9=")
         (endpoint "example.org")
         (allowed-ips '()))
        (wireguard-peer
         (name "dummy3")
         (public-key "BlesLiEB5BFd//OD2ILKXviolfz+hodG6uZ+XgoalC7=")
         (endpoint "10.0.0.7:7777")
         (allowed-ips '()))
        (wireguard-peer
         (name "dummy4")
         (public-key "ClesLiEB5BFd//OD2ILKXviolfz+hodG6uZ+XgoalC6=")
         (endpoint "[2345:0425:2CA1::0567:5673:23b5]:44444")
         (allowed-ips '()))))

(test-equal "peers->endpoint-host-names"
  '("some.dynamic-dns.service" "example.org")
  (peers->endpoint-host-names %wireguard-peers))

(test-end "vpn-services")

debug log:

solving 9c6fa65df6 ...
found 9c6fa65df6 in https://yhetil.org/guix-patches/81431f5906cd69b4377e1f5d5b26e7c915c7cc87.1683679924.git.maxim.cournoyer@gmail.com/ ||
	https://yhetil.org/guix-patches/76b34e5229e0e97068cb3bd42152f29630a8dbfc.1684210148.git.maxim.cournoyer@gmail.com/ ||
	https://yhetil.org/guix-patches/a07e9f398564ddb9499c525bf5ed75988d1b0dab.1684167181.git.maxim.cournoyer@gmail.com/

applying [1/1] https://yhetil.org/guix-patches/81431f5906cd69b4377e1f5d5b26e7c915c7cc87.1683679924.git.maxim.cournoyer@gmail.com/
diff --git a/tests/services/vpn.scm b/tests/services/vpn.scm
new file mode 100644
index 0000000000..9c6fa65df6

Checking patch tests/services/vpn.scm...
Applied patch tests/services/vpn.scm cleanly.

skipping https://yhetil.org/guix-patches/76b34e5229e0e97068cb3bd42152f29630a8dbfc.1684210148.git.maxim.cournoyer@gmail.com/ for 9c6fa65df6
skipping https://yhetil.org/guix-patches/a07e9f398564ddb9499c525bf5ed75988d1b0dab.1684167181.git.maxim.cournoyer@gmail.com/ for 9c6fa65df6
index at:
100644 9c6fa65df65f090d3538ec1bc595229d10fc4134	tests/services/vpn.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).