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 eHiPBwiGJGeGPQEA62LTzQ:P1 (envelope-from ) for ; Fri, 01 Nov 2024 07:40:56 +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 eHiPBwiGJGeGPQEA62LTzQ (envelope-from ) for ; Fri, 01 Nov 2024 08:40:56 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=JwJlsH20; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=nKue4UhM; 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=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1730446856; 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=YW0IwPW2KUgT8ahlSg7rMrPAp0AJ7jQKaOE98yUb5ac=; b=STnMHhgI1QXisUnXpA9YmAiXd/Q2rBf5Uo8rszPyBd5L49La0+BGJbEfA5Fm9BTsbCz+kV s5ujBSGB/PMt7MwO2dyNTg8pcqZqX6+hoeUk2Yxyx9DaZEM88GK2CiAPFZHaTtTq2mXbMw 8rFSR3nMFx/r64hOY+ASSkzYVFtuzWp+pa9H6Azt+saDHYfMDLo/xi6mm/cYoo0QB9RhuF uwRSYFOU2eebipqUlWdHxp+IfKd0JCOQzh3ES4NZ8RXwh1ICVpsaDW3ymwlcBV6nUBVqN3 xZKky00VYGm8CyzfCon1oMu+LxVihxfgO3CFX90JKGDtAPW3+W2I3xVcUgtiyg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1730446856; a=rsa-sha256; cv=none; b=OXbPtQHb4kTytlwoM978khKBiy1O9UiZGQftwKhCtcxHvMlRK3KAhjnc+5PnxdM2KB9uWR TzZS5DGSkN2PVH6iwhUXWsECaK4JZKYnrclHgOYWYM03Wvv8yb5d3ZyEMmm7gSPofmGCbi gBROJum6+HBOHJWaZwZFITNWnDQ3LrTfuD0hNMMuLzlKrwMQ2e6crJfqxLriZ/AEAwix5o U/d5S75ozW+WCEL7Gp6okWWGGLUlP4/QtflSR2ZT8ULmziUJGQQVTmgpogNcCUGdy6Fe1j RdqpTW2AeRonKpz0WvqK130P8yIT5fA8MH/jrhHbD2p6HLjaBHJ7dAPQC9mDlg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=JwJlsH20; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=nKue4UhM; 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=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) 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 A98D479440 for ; Fri, 01 Nov 2024 08:40:55 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6lrJ-0004Mv-3v; Fri, 01 Nov 2024 03:14:13 -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 1t6lrE-0004LI-Ly for guix-patches@gnu.org; Fri, 01 Nov 2024 03:14:08 -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 1t6lrB-0001Ca-I4 for guix-patches@gnu.org; Fri, 01 Nov 2024 03:14:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=qFi3QBVToxtiUJVjnqz3ki5qf04RYuRlBJbYPwgyI0I=; b=JwJlsH207P5bJT0uk8LtrkNsS7WIxKzm7cyetmjP3HmwbjTgUg2w30dxoViFi/XXaWLY29Lr2hNWJjI731rsYxEtUO3HrrGiB4tY8A5pFJsM9ayFJEjGAunbvoB1+39mKdHqkhQe3Wv3VcXfdM+10lN5t0TEEtVHmTkowC6ASg65bpjBPFKarZrosNL/QtPBfypvNfOs9WTet6C4+v309wbzo6y1s90/cGA3FgM1u54+RSFzUaa1yOMHW6/tZR1X5qA/CrydA21sdZWwTJcsL8eyakLuX2nvPPU5nDWWy0yLxqNTfb6U+kM9eOyfL5bnc9ze8GRhE9jySDLamCvBnw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6lrB-0005LO-Cx; Fri, 01 Nov 2024 03:14:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#74151] [PATCH 7/7] tests: Add anonip system test. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 01 Nov 2024 07:14:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74151 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74151@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer X-Debbugs-Original-Xcc: Maxim Cournoyer Received: via spool by 74151-submit@debbugs.gnu.org id=B74151.173044522620475 (code B ref 74151); Fri, 01 Nov 2024 07:14:05 +0000 Received: (at 74151) by debbugs.gnu.org; 1 Nov 2024 07:13:46 +0000 Received: from localhost ([127.0.0.1]:47347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6lqr-0005KB-E4 for submit@debbugs.gnu.org; Fri, 01 Nov 2024 03:13:45 -0400 Received: from mail-qt1-f181.google.com ([209.85.160.181]:47461) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6lqp-0005Jt-Fb for 74151@debbugs.gnu.org; Fri, 01 Nov 2024 03:13:44 -0400 Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-4609d8874b1so12439311cf.3 for <74151@debbugs.gnu.org>; Fri, 01 Nov 2024 00:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730445158; x=1731049958; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qFi3QBVToxtiUJVjnqz3ki5qf04RYuRlBJbYPwgyI0I=; b=nKue4UhMBc90OopVtiehHPp7kXXIA6TdldjxQ6EG1m9H+oZVF852hMCAdjmnCksGWx poYWb9iaPUx8uLldcTDiFjppgdpP61ghHwCS4E50FICqSN7xnwZ45x4hoK7ZJTTQqi5P x1wBKqMb3eLLdNa6jo2F/HiDtLPNXHa96oP2gJbQCg2JtK5QJVDP/pacnWiU8BVFHEuR Tyljo+PeElvm2p1iOskUthjC/U/fRQSkDU2X/VgrBOpcZNBp3gnx9GWFoBBBqlJz+GUr 4JLnVTVkdm1FsTXssViwACv1E72lOSmaf/JiRg0PmFpjrZvUSdoq/5Qlw9Z/g0ITr3Rm H+dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730445158; x=1731049958; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qFi3QBVToxtiUJVjnqz3ki5qf04RYuRlBJbYPwgyI0I=; b=HXEtXo7I2eCe943dZO6BCi6nG6qJaUkWwpaWY2pLx0C1CPvbzoAiPVruQgM7LphPjs g6RgwIL27h9/yvm2bd8mKUTBkePcmxfG7/WeYjnQNxnSaHnQfZcRJ5KzJ+f5a6fqPWYi C481lCCRm6SkopfmyChJJovSmBifL9m45kFOJ9P9F/NXIgv4zN05zWaC88Kl6gmLvjyi Lbyeos/Y6z3tqBt4XPTsQeqRAqcrCtBXjOGVOLqKPOQqXplhUZxOdMNcQU6dK781sbh1 AsF7W0+MqDKorLR1lrdy7RH65GzYq2ptXmxZOH/d59zZjDS7HWRDX4dg8JIBj6YdJ14T G8hA== X-Gm-Message-State: AOJu0YxuGQ+UdV1ZVbOdfbmcbIjAr7IghN1uCiEngBQ7TZqFuCHKunCR tvslH7HI2JfCxTPXadvghOhv0IeDRhQaHFnluA5l1IpeQP/z1Mh0r7kqspZf X-Google-Smtp-Source: AGHT+IHpZMJcSVV6AQ1ebuMXyUMySqHvZsRDTYDTiEzbguvEQ+z+bDiu52WRPKU2z0o2pI+d0VBYYA== X-Received: by 2002:a05:622a:198a:b0:45f:8c1:41af with SMTP id d75a77b69052e-462ab2fc97fmr77878551cf.41.1730445157556; Fri, 01 Nov 2024 00:12:37 -0700 (PDT) Received: from localhost.localdomain (vps-6234970c.vps.ovh.ca. [51.222.13.224]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-462ad1a0f59sm15646821cf.81.2024.11.01.00.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 00:12:36 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 1 Nov 2024 16:11:43 +0900 Message-ID: <7c762086c432d21da2c664d4ee26c051fb54a481.1730441684.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: 6.31 X-Spam-Score: 6.31 X-Migadu-Queue-Id: A98D479440 X-Migadu-Scanner: mx13.migadu.com X-TUID: M6ISkvGmAqzi * gnu/tests/web.scm (%test-anonip): New test. (%anonip-os): New variables. (run-anonip-test): New procedure. Change-Id: Ieed210a784dbdeee8a498e74b6c0e31cb72cd9b8 --- gnu/tests/web.scm | 115 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 5c50322cef..f7a5659dc5 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2018 Pierre-Antoine Rouby ;;; Copyright © 2018 Marius Bakke +;;; Copyright © 2024 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,6 +34,7 @@ (define-module (gnu tests web) #:use-module (gnu services networking) #:use-module (gnu services shepherd) #:use-module (gnu services mail) + #:use-module (gnu packages base) #:use-module (gnu packages databases) #:use-module (gnu packages guile-xyz) #:use-module (gnu packages patchutils) @@ -52,6 +54,7 @@ (define-module (gnu tests web) %test-php-fpm %test-hpcguix-web %test-tailon + %test-anonip %test-patchwork %test-agate)) @@ -509,6 +512,118 @@ (define %test-tailon (description "Connect to a running Tailon server.") (value (run-tailon-test)))) + +;;; +;;; Anonip +;;; +(define %anonip-os + ;; Operating system under test. + (simple-operating-system + (service anonip-service-type + (anonip-configuration + (input "/var/run/anonip/http.access.log") + (output "/var/log/anonip/http.access.log") + (debug? #t))))) + +(define (run-anonip-test) + (define os + (marionette-operating-system + %anonip-os + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define vm + (virtual-machine + (operating-system os) + ;; We are interested in verifying if anonip still launches following a + ;; reboot; thus make the base image writable. + (volatile? #f))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (ice-9 match) + (srfi srfi-64) + (gnu build marionette)) + + (define marionette + (make-marionette (list #$vm))) + + (test-runner-current (system-test-runner #$output)) + (test-begin "anonip") + + (test-assert "service is running" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (wait-for-service 'anonip-/var/log/anonip/http.access.log)) + marionette)) + + (test-assert "service can be restarted" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (restart-service 'anonip-/var/log/anonip/http.access.log) + (wait-for-service 'anonip-/var/log/anonip/http.access.log)) + marionette)) + + (test-assert "ip addresses are anonymized" + (marionette-eval + '(begin + (use-modules (ice-9 textual-ports)) + (call-with-output-file "/var/run/anonip/http.access.log" + (lambda (port) + (display "192.168.100.200 - - \ +[30/Oct/2024:14:57:44 +0100] GET /xxx.narinfo HTTP/1.1\" 200 1065 \ +\"-\" \"GNU Guile\"\n" port) + (display "2001:0db8:85a3:0000:0000:8a2e:0370:7334 - - \ +[30/Oct/2024:14:57:44 +0100] \"GET /xxx.narinfo HTTP/1.1\" 200 1065 \ +\"-\" \"GNU Guile\"\n" port))) + (#$retry-on-error + (lambda () + (call-with-input-file "/var/log/anonip/http.access.log" + (lambda (port) + (let ((content (get-string-all port))) + ;; The expected values are taken from anonip's test + ;; suite (see its test_module.py file). + (or (and (string-contains content "192.168.96.0") + (string-contains content "2001:db8:85a0::")) + (error "could not find expected anonymized IPs" + content)))))) + #:times 20 + #:delay 1)) + marionette)) + + (test-assert "service is running after reboot" + (begin + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (eval-there '(begin + (use-modules (shepherd system)) + (sync) ;ensure the log is fully written + (reboot)))) + marionette) + ;; Note: a distinct marionette-eval call is needed here; if + ;; included in the previous one issuing the reboot, + ;; 'wait-for-service' would apparently run before the system had + ;; rebooted (and succeed), which would defeat the test. + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (wait-for-service 'anonip-/var/log/anonip/http.access.log)) + marionette))) + + (test-end)))) + + (gexp->derivation "anonip-test" test)) + +(define %test-anonip + (system-test + (name "anonip") + (description "Anonymize logs via Anonip") + (value (run-anonip-test)))) + ;;; ;;; Patchwork -- 2.46.0