From patchwork Thu Sep 1 09:43:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 42110 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3F89B27BBEA; Thu, 1 Sep 2022 10:52:52 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CB01627BBE9 for ; Thu, 1 Sep 2022 10:52:51 +0100 (BST) Received: from localhost ([::1]:57382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTgsU-0006eZ-VP for patchwork@mira.cbaines.net; Thu, 01 Sep 2022 05:52:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTgjz-0005j3-KU for guix-patches@gnu.org; Thu, 01 Sep 2022 05:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTgjz-0003vF-9X for guix-patches@gnu.org; Thu, 01 Sep 2022 05:44:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oTgjx-00012z-VS for guix-patches@gnu.org; Thu, 01 Sep 2022 05:44:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57515] [PATCH 9/9] tests/gnu-maintenance: Test latest-html-release. References: In-Reply-To: Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 01 Sep 2022 09:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57515 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57515@debbugs.gnu.org Cc: Maxime Devos Received: via spool by 57515-submit@debbugs.gnu.org id=B57515.16620254253996 (code B ref 57515); Thu, 01 Sep 2022 09:44:01 +0000 Received: (at 57515) by debbugs.gnu.org; 1 Sep 2022 09:43:45 +0000 Received: from localhost ([127.0.0.1]:41265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTgjg-00012O-Ny for submit@debbugs.gnu.org; Thu, 01 Sep 2022 05:43:45 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:59370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTgjf-00012E-2m for 57515@debbugs.gnu.org; Thu, 01 Sep 2022 05:43:44 -0400 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:5dba:d409:33f7:a16]) by xavier.telenet-ops.be with bizsmtp id EZjg2800620ykKC01ZjgAt; Thu, 01 Sep 2022 11:43:41 +0200 From: Maxime Devos Date: Thu, 1 Sep 2022 11:43:38 +0200 Message-Id: <20220901094338.12499-1-maximedevos@telenet.be> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1662025421; bh=enSES2dlqhEnaztwWWQvhzta54+9FnCJVvIZZW8wjP8=; h=From:To:Cc:Subject:Date; b=JIGgqShJTIrvYio7CyMMZ7a4dUiljQxkhVYLy4zP41kouPkVO18orx0wWTVaReqW6 iU6giHChlyK4Mwx344MebvFI7+mfXqT8Qern20vAOCJebo5G6t2AuQh8rsbnYusqFW vIxV78wumB45kdvDgiPI/fFSDpEv31UKXDdoV2vTaZkK079lJlA3xtwFa6FVmX2mLa SGZldR+ILGfylPPjSJhS1qmjqa8IaDA8brlcvGh7YW8TL2M11kBtsmU7w/nJR4s02n dX0TYHuXGtOOWxipGF4K3r6+Go3aahjMtgisCCbj2mGtGN2nn0T5L5JmeDB1g8IJ42 v/eGgZegnKXbQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * tests/gnu-maintenance.scm ("latest-html-release, no signature") ("latest-html-release, signature): Two new tests. --- tests/gnu-maintenance.scm | 70 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/tests/gnu-maintenance.scm b/tests/gnu-maintenance.scm index c04d8ba733..a9e2a0bb9f 100644 --- a/tests/gnu-maintenance.scm +++ b/tests/gnu-maintenance.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015, 2021 Ludovic Courtès +;;; Copyright © 2022 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,9 +19,14 @@ (define-module (test-gnu-maintenance) #:use-module (guix gnu-maintenance) + #:use-module (guix tests) + #:use-module (guix tests http) + #:use-module (guix upstream) + #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64) - #:use-module (ice-9 match)) + #:use-module (ice-9 match) + #:use-module (ice-9 textual-ports)) (test-begin "gnu-maintenance") @@ -55,4 +61,66 @@ (define-module (test-gnu-maintenance) ("mpg321_0.3.2.orig.tar.gz" "0.3.2") ("bvi-1.4.1.src.tar.gz" "1.4.1"))))) +(test-assert "latest-html-release, no signature" + (with-http-server + `((200 " + +Releases! + + +version 1 +version 2 + +")) + (let () + (define package + (dummy-package "foo" + (source + (dummy-origin + (uri (string-append (%local-url) "/foo-1.tar.gz")))) + (properties + `((release-monitoring-url . ,(%local-url)))))) + (define update ((upstream-updater-latest %generic-html-updater) package)) + (define expected-new-url + (string-append (%local-url) "/foo-2.tar.gz")) + (and (pk 'u update) + (equal? (upstream-source-version update) "2") + (equal? (list expected-new-url) + (upstream-source-urls update)) + (null? ;; both #false and the empty list are acceptable + (or (upstream-source-signature-urls update) '())))))) + +(test-assert "latest-html-release, signature" + (with-http-server + `((200 " + +Signed releases! + + +version 1 +version 2 +version 1 signature +version 2 signature + +")) + (let () + (define package + (dummy-package "foo" + (source + (dummy-origin + (uri (string-append (%local-url) "/foo-1.tar.gz")))) + (properties + `((release-monitoring-url . ,(%local-url)))))) + (define update ((upstream-updater-latest %generic-html-updater) package)) + (define expected-new-url + (string-append (%local-url) "/foo-2.tar.gz")) + (define expected-signature-url + (string-append (%local-url) "/foo-2.tar.gz.sig")) + (and (pk 'u update) + (equal? (upstream-source-version update) "2") + (equal? (list expected-new-url) + (upstream-source-urls update)) + (equal? (list expected-signature-url) + (upstream-source-signature-urls update)))))) + (test-end)