From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 0GMHH9UFcmYVAAAAqHPOHw:P1 (envelope-from ) for ; Tue, 18 Jun 2024 22:10:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 0GMHH9UFcmYVAAAAqHPOHw (envelope-from ) for ; Wed, 19 Jun 2024 00:10:29 +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=qg7kXCfT; dmarc=none; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718748629; 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=ndeAEhgOmWt/RWqh6CBSsItSMi5TBX17zPJrwIfAoqQ=; b=uCASdQpdTKWCsQ/ehMwlYh/FTyRggCFNxSWgJoQ/0y1HM19/wjnBtlkz2NO5/faJZCIxTM 3Om//kTqGMQfXuqRsjHo9zKvZyxvglfBvtZkn9pwKKjWWFANgQUKMsdkhv2LKAxUgKb4KT bz43CiQ3y2dYGSFXHkZFVKpyrt//NeGFRxKREn2lB42uXURISpjHMKanADGk60cTWdueJF SPt7qvJ+oNlRUDGEe/ABaXH4YXalBkWWXWVPzrf8nOGPAn6yoj66ESRnnYXGssiAf4HrKs 3jw0sX5UZ5Gge3bZ5BuOsGN/k4+lx3X+90f4Ia3ftlgp81VcjcYwJ0qw3GcQ7A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718748629; a=rsa-sha256; cv=none; b=eXRSXbZ5PcpPv/x5Go2jg0pPp5++4IShPjen7VMdhoKbPtrj1+E5YwbnT1Z/h+LXK0XJob fj+2RbC5iSe64yhKSzFg0WpuPhx/Zmj3r++k9qMcp6B2SXAVhzpes5Y/5ibQyooNGSyfbx 7Lbmv0MtqGiDkm/65O8OwwHb+IWkrCTm9pBz7B0zbBEDRmgFz2O8hTjZDovFMq6xcH0kba NT6qyM2+VshERoYub2mpTOoQjcnVSk1/Df3lwbgF2UFF3SPuhUc9inICtvTXbi2yB96vhI Og3t1Tr+SrrslthYvBVHU0jDbrypViNZfGfyoZ/iMh31Q1E73X9cS3Y8tNa+8w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=qg7kXCfT; dmarc=none; 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" 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 233DCAB03 for ; Wed, 19 Jun 2024 00:10:29 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJh1g-0005iM-4r; Tue, 18 Jun 2024 18:10:04 -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 1sJh1e-0005hb-3f for guix-patches@gnu.org; Tue, 18 Jun 2024 18:10: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 1sJh1d-0003CG-RF for guix-patches@gnu.org; Tue, 18 Jun 2024 18:10:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sJh1g-000357-Kk for guix-patches@gnu.org; Tue, 18 Jun 2024 18:10:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71639] [PATCH WIP 5/5] tests: Add restic system test. Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 18 Jun 2024 22:10:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71639 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71639@debbugs.gnu.org Cc: ludo@gnu.org, Richard Sent , goodoldpaul@autistici.org Received: via spool by 71639-submit@debbugs.gnu.org id=B71639.171874857711732 (code B ref 71639); Tue, 18 Jun 2024 22:10:04 +0000 Received: (at 71639) by debbugs.gnu.org; 18 Jun 2024 22:09:37 +0000 Received: from localhost ([127.0.0.1]:53641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJh1F-000333-2c for submit@debbugs.gnu.org; Tue, 18 Jun 2024 18:09:37 -0400 Received: from mail-108-mta97.mxroute.com ([136.175.108.97]:45899) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJh1B-00032f-Ri for 71639@debbugs.gnu.org; Tue, 18 Jun 2024 18:09:34 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta97.mxroute.com (ZoneMTA) with ESMTPSA id 1902d65dda800017a3.002 for <71639@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 18 Jun 2024 22:09:29 +0000 X-Zone-Loop: d6e4ff4ee7c9d42ed7e0be8edd2dfc981f196448efac 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=ndeAEhgOmWt/RWqh6CBSsItSMi5TBX17zPJrwIfAoqQ=; b=qg7kXCfTvw33alVZkjc/qz7c0Z 0AipGSri43VBoQNwoD4GlA7vKt15qYix6yJXp4X8oWtvxdsszySdxwQTxjU/0LrwH37YES/gLut3Q 57LLcfdOrpCmlD0ZSsXARsIhBvhjFWaTIBPh9K2rklifTH80/lvnqNlNtXj2Bwd4gCTg8906PGDhf Gtl5jxLe9cuNPBVryj7Q3j8e9IOTK0Qom6APEOAGolEpXGMl5dHZMQL+F7qNoU0zQmSt2xwyBpq3B PJioooxas+MGZuedMR3iLKxg8MOOkrR4Qk2C7iPR9EEmr0UMWgC2uIJT7MmjA8rX+0t7X8S0An1H1 zc0pvtVA==; From: Richard Sent Date: Tue, 18 Jun 2024 18:08:52 -0400 Message-ID: <8efb248a6930d4e82d9f0e1e9cf77369c67780ca.1718747513.git.richard@freakingpenguin.com> 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 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -2.36 X-Spam-Score: -2.36 X-Migadu-Queue-Id: 233DCAB03 X-Migadu-Scanner: mx11.migadu.com X-TUID: Ee/5XVjpmY4Z * gnu/tests/restic.scm: Create. Change-Id: Iad5472414c140b133d9b402855bb2f01e96bb0cc --- gnu/tests/restic.scm | 124 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 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..f8ea76538e --- /dev/null +++ b/gnu/tests/restic.scm @@ -0,0 +1,124 @@ +;;; 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) + ;; TODO: Remove what I can from here. + #:use-module (gnu bootloader) + #:use-module (gnu bootloader grub) + #:use-module (gnu packages) + #:use-module (gnu packages sync) ;rclone + #:use-module (gnu packages xorg) + #:use-module (gnu services) + #:use-module (gnu services desktop) + #:use-module (gnu services backup) ;restic + #:use-module (gnu services xorg) + #: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) + ;; TODO: We might be able to lower this. + (memory-size 1024))) + + (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