guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/05: channels: Fix test for introductory commit signer.


From: guix-commits
Subject: 03/05: channels: Fix test for introductory commit signer.
Date: Wed, 24 Jun 2020 19:22:55 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit a18d02def9862dfb9b7a5e3d5aa3b541b066d198
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Jun 24 14:48:07 2020 +0200

    channels: Fix test for introductory commit signer.
    
    Until now the test would always succeed because it would return
    'failed, which has truth value.  The exercise
    'verify-introductory-commit', we need to add a second commit beyond the
    introductory commit, which is what we do here.
    
    * tests/channels.scm ("authenticate-channel, wrong first commit
    signer"): Add a second commit and authenticate up to that one.  Change
    'message?' to 'message-condition?'.
---
 tests/channels.scm | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/channels.scm b/tests/channels.scm
index 5f13a48..3a2c1d4 100644
--- a/tests/channels.scm
+++ b/tests/channels.scm
@@ -403,7 +403,8 @@
                     '(#f "tag-for-first-news-entry")))))))
 
 (unless (gpg+git-available?) (test-skip 1))
-(test-assert "authenticate-channel, wrong first commit signer"
+(test-equal "authenticate-channel, wrong first commit signer"
+  #t
   (with-fresh-gnupg-setup (list %ed25519-public-key-file
                                 %ed25519-secret-key-file
                                 %ed25519bis-public-key-file
@@ -422,9 +423,13 @@
           (add "signer.key" ,(call-with-input-file %ed25519-public-key-file
                                get-string-all))
           (commit "first commit"
+                  (signer ,(key-fingerprint %ed25519-public-key-file)))
+          (add "random" ,(random-text))
+          (commit "second commit"
                   (signer ,(key-fingerprint %ed25519-public-key-file))))
       (with-repository directory repository
         (let* ((commit1 (find-commit repository "first"))
+               (commit2 (find-commit repository "second"))
                (intro   ((@@ (guix channels) make-channel-introduction)
                          (commit-id-string commit1)
                          (openpgp-public-key-fingerprint
@@ -434,11 +439,11 @@
                (channel (channel (name 'example)
                                  (url (string-append "file://" directory))
                                  (introduction intro))))
-          (guard (c ((message? c)
+          (guard (c ((message-condition? c)
                      (->bool (string-contains (condition-message c)
                                               "initial commit"))))
             (authenticate-channel channel directory
-                                  (commit-id-string commit1)
+                                  (commit-id-string commit2)
                                   #:keyring-reference-prefix "")
             'failed))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]