From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id MP12LiGmc2ZLaAAA62LTzQ:P1 (envelope-from ) for ; Thu, 20 Jun 2024 03:46:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id MP12LiGmc2ZLaAAA62LTzQ (envelope-from ) for ; Thu, 20 Jun 2024 05:46:41 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=F+HHUaRz; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718855201; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ID4dv26EDja7geOt5SQBFDdNXc/hjEVNkcddZN2hvx0=; b=sAIXhAWxcE52mGEmvQsOXHQc7/HoM6cUQIJmi+Qs2G2W6aNoXooCJS4OVWy2wVY188Z+1k c7hgC9eJx7v6e2kNsUVQHbiLupoVkS4yFTn8mJrGDse6mURFpIvlHOt4ZHysiytqxZOWVS HhOEqelfqcCgws1YG6CDdhGURanXeqw5pmMXtHOoUAc2pwsDnwur5+ohe+SNUnM/SXbml9 VWChG245z1B0msSOp//bCmAl3sKuCcabE6vb9MKdltt6ONSUTxoa4CiRgRjpzffmWJxU55 VWPh6B5gb8Cq0RUxY6N0R60nx5PLuWa9XX0auuM1XeBhBCH8+CPhAQimdlvKPQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=F+HHUaRz; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718855201; a=rsa-sha256; cv=none; b=q3i6/kaMH7ceGgP+3HjQa3mg09U69EIzHL09xHCQwDt7r34O5KJrTe+g/R4V66iCPL4OAB 7X8Xn1AXnKrzyNuD+7j2uNFEbump9N2/iDjBc8p5MU6rpjW5AGKN3jqDvQj7HCMs49NlEZ +KKJ0jneNQ8bIzTSEkpE4Un3jYf2yRp2fxib25a3JNBKPy4XOm/+U5K+Y3/9BMlPu3mhdw +BnrNb1G965AIhh5fBUhsh8FM+0YwXEMiQcy4ATQmpP9cp5+JEIU7EAexlWi7JSc80yswz dpQO8bGp93OaX4ZfN6dosAXL0tWTlzyyArVXC36D0X8opi2MJD4LYUKJO0Hjpg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 643553DDD7 for ; Thu, 20 Jun 2024 05:46:41 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sK8kN-0006uH-Bg; Wed, 19 Jun 2024 23:46:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sK8kM-0006tm-GD for guix-patches@gnu.org; Wed, 19 Jun 2024 23:46:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sK8kM-0007Sw-5m for guix-patches@gnu.org; Wed, 19 Jun 2024 23:46:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sK8kP-0006ap-OL for guix-patches@gnu.org; Wed, 19 Jun 2024 23:46:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71665] [PATCH v2 5/5] tests: Add restic system test. Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Jun 2024 03:46:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71665 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71665@debbugs.gnu.org, 71639@debbugs.gnu.org Cc: Richard Sent X-Debbugs-Original-To: guix-patches@gnu.org, 71639@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171885514725231 (code B ref -1); Thu, 20 Jun 2024 03:46:05 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jun 2024 03:45:47 +0000 Received: from localhost ([127.0.0.1]:41542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sK8k6-0006Yr-QN for submit@debbugs.gnu.org; Wed, 19 Jun 2024 23:45:47 -0400 Received: from lists.gnu.org ([209.51.188.17]:39478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sK8k0-0006YL-Nc for submit@debbugs.gnu.org; Wed, 19 Jun 2024 23:45:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sK8jw-0006lp-Rc for guix-patches@gnu.org; Wed, 19 Jun 2024 23:45:36 -0400 Received: from mail-108-mta146.mxroute.com ([136.175.108.146]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sK8ju-0007I8-Pq for guix-patches@gnu.org; Wed, 19 Jun 2024 23:45:36 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta146.mxroute.com (ZoneMTA) with ESMTPSA id 19033bfc8c300017a3.002 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 20 Jun 2024 03:45:25 +0000 X-Zone-Loop: 3c6e924dc0902687f6a669b936b4546a22748b27af01 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ID4dv26EDja7geOt5SQBFDdNXc/hjEVNkcddZN2hvx0=; b=F+HHUaRzWlrilLBq2mvVYqJyez Aa1mZO6dxkkO+9/5bWjiHa0nWWKgo79NqdOW19SKrarDA2Qzb8j+1+YptHFfBnDJgDpjDByX5eveD 6/S2k3w0Q30tnL3rVPe0ADWv6fewPyJuwnMQo1Za6pKbZ/XpEz3iKx1z9yj5cbm37uJhUtP5SvQ93 qk2HKGUMAAax3gmcRqyVe/p5W7WH1MlmuOjY7X26nkOLXu9fOFBFkumPAGfum1vyVXzmw9/PK54hk 8DTuRs+pOqKJRSGcTEOFpOWD08Jq//gwViD/MYtvXkhXS2N9cJL1U/24d+kXTfDm2FZB1vyfJqPK2 64dAlfiw==; From: Richard Sent Date: Wed, 19 Jun 2024 23:44:16 -0400 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.146; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta146.mxroute.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 643553DDD7 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -5.56 X-Spam-Score: -5.56 X-TUID: 8vAiFL72eGWN * gnu/tests/restic.scm: Create. Change-Id: Iad5472414c140b133d9b402855bb2f01e96bb0cc --- gnu/tests/restic.scm | 119 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 gnu/tests/restic.scm diff --git a/gnu/tests/restic.scm b/gnu/tests/restic.scm new file mode 100644 index 0000000000..8d29ff441b --- /dev/null +++ b/gnu/tests/restic.scm @@ -0,0 +1,119 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2024 Richard Sent . +;;; +;;; 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 . + +(define-module (gnu tests restic) + #:use-module (gnu bootloader) + #:use-module (gnu bootloader grub) + #:use-module (gnu packages) + #:use-module (gnu packages sync) ;rclone + #:use-module (gnu services) + #:use-module (gnu services backup) ;restic + #:use-module (gnu system) + #:use-module (gnu system vm) + #:use-module (gnu tests) + #:use-module (guix gexp) + #:use-module (guix modules) + #:use-module (srfi srfi-1) + #:export (%test-restic)) + +(define password "password") + +(define password-file + (plain-file "password-file" password)) + +(define password-command + (program-file "password-command" #~(display #$password))) + +(define (run-restic-test) + "Run tests in %restic-os." + + (define os + (marionette-operating-system + (simple-operating-system (extra-special-file "/root/.restic-test" + (plain-file "restic-test" + "Hello world!")) + ;; restic-backup-service only takes a string to avoid putting + ;; plaintext entries in the store. Ergo, symlink it. + (extra-special-file "/root/password-file" + password-file) + (service restic-backup-service-type + (restic-backup-configuration + (jobs + (list (restic-backup-job + (name "password-file-backup") + (repository "/root/restic-password-file-repo") + (schedule #~'(next-second '(0 15 30 45))) + (password-file "/root/password-file") + (files '("/root/.restic-test")) + (init? #t)) + (restic-backup-job + (name "password-command-backup") + (repository "/root/restic-password-command-repo") + (schedule #~'(next-second '(0 15 30 45))) + (password-command password-command) + (files '("/root/.restic-test")) + (init? #t))))))) + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define vm (virtual-machine + (operating-system os) + (memory-size 512))) + + (define test + (with-imported-modules (source-module-closure + '((gnu build marionette))) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-26) + (srfi srfi-64)) + + (let ((marionette (make-marionette (list #$vm)))) + + (test-runner-current (system-test-runner #$output)) + (test-begin "restic") + + (test-assert "backup-file-created" + (wait-for-file "/root/.restic-test" marionette)) + + (test-assert "mcron running" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'mcron)) + marionette)) + + (test-assert "password-file backup completed" + (wait-for-file "/root/restic-password-file-repo/config" marionette + ;; Restic takes a second to run, give it a bit + ;; more time. + #:timeout 20)) + + (test-assert "password-comand backup completed" + (wait-for-file "/root/restic-password-file-repo/config" marionette + #:timeout 20)) + + (test-end))))) + + (gexp->derivation "restic-test" test)) + +(define %test-restic + (system-test + (name "restic") + (description "Basic tests for the restic service.") + (value (run-restic-test)))) -- 2.45.1