summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-06-24 14:53:08 +0200
committerLudovic Courtès <ludo@gnu.org>2020-06-28 23:26:53 +0200
commitead5c46147ebf352ad4804d52a766dcf105eda4f (patch)
treed661f86f3f5be15f4920e42858019c41cc107a32 /tests
parent0a8dd8aae5fad365c2f429d48e4085a3b3388332 (diff)
downloadguix-ead5c46147ebf352ad4804d52a766dcf105eda4f.tar.gz
channels: Error out when the 'guix' channel lacks an introduction.
* guix/channels.scm (latest-channel-instance): Raise an error instead of
warning when 'guix is unauthenticated.
* tests/channels.scm ("latest-channel-instances, missing introduction for 'guix'"):
New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/channels.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/channels.scm b/tests/channels.scm
index 3a2c1d429b..d7202f8cbf 100644
--- a/tests/channels.scm
+++ b/tests/channels.scm
@@ -402,6 +402,27 @@
                          (channel-news-for-commit channel commit5 commit1))
                     '(#f "tag-for-first-news-entry")))))))
 
+(unless (which (git-command)) (test-skip 1))
+(test-assert "latest-channel-instances, missing introduction for 'guix'"
+  (with-temporary-git-repository directory
+      '((add "a.txt" "A")
+        (commit "first commit")
+        (add "b.scm" "#t")
+        (commit "second commit"))
+    (with-repository directory repository
+      (let* ((commit1 (find-commit repository "first"))
+             (commit2 (find-commit repository "second"))
+             (channel (channel (url (string-append "file://" directory))
+                               (name 'guix))))
+
+        (guard (c ((message-condition? c)
+                   (->bool (string-contains (condition-message c)
+                                            "introduction"))))
+          (with-store store
+            ;; Attempt a downgrade from NEW to OLD.
+            (latest-channel-instances store (list channel))
+            #f))))))
+
 (unless (gpg+git-available?) (test-skip 1))
 (test-equal "authenticate-channel, wrong first commit signer"
   #t