From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 8DRJFPZCP2ei8wAA62LTzQ:P1 (envelope-from ) for ; Thu, 21 Nov 2024 14:25:58 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 8DRJFPZCP2ei8wAA62LTzQ (envelope-from ) for ; Thu, 21 Nov 2024 15:25:58 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=At7mvQls; dkim=fail ("headers rsa verify failed") header.d=mmer.org header.s=dkim header.b=Lg5HQWL2; dmarc=pass (policy=none) header.from=gnu.org; 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-Seal: i=1; s=key1; d=yhetil.org; t=1732199158; a=rsa-sha256; cv=none; b=Halv+jpA/re6Zxeh7YxsGjcp7geVqycHc4wFdLQ+W8nF+hUWo+qBSbEhss5aTWdQmJsjEi EftgTCh2sHlu6FDtzBrOccc/veq5GzLcD0saRbDpKEJy0cPYG0so9i16TKAn/ZbCOe2e31 lFnwv/aTu4lXE87qYf9eno+NwtYfpI3RrBFHXOzG5F05dFvdIipRKK6g54uFpxN1Gpllxb UVDVB/ftM9p9Y5LibsWT2pF5/dvrnmuiN1mQYo5NQyvo1EKmW9NkBakfCb4DtDG4XXcbcL maHBB4L3SOHFpJ2r1wOSpI4xKFLdoCKvXTVBRgbnMJ8E7hh59KQEGwJFcg888A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=At7mvQls; dkim=fail ("headers rsa verify failed") header.d=mmer.org header.s=dkim header.b=Lg5HQWL2; dmarc=pass (policy=none) header.from=gnu.org; 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=1732199158; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: 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=2179E/YnXyM8ZBbGZmXQ1H6HB96ZBNNJdJEakthEzjk=; b=CwyJUV0xvPzyYLWOEx/cUH6cLD0OFT14GeI2tZVqWl7DdO5nIwaTuiK4V7RoaMjxpzed/+ PHU0m6lElylh4FYWtud3MvYtrO9e6Xlao7rwvDmiF77+vam8GDwxLyD4jWNGgGvXr5QcQG tOpAC55E/e72WQE1cCIkk2qqNGaWxmBAwcrE+kzbDudhCMhcQEyX/fzQn3NiKzR4+Wp9aC g8UNRucc9cSOWtL0ng5kaPiLlPclHuunrSQ5u5XqVkO14XfSTdp6F3Mc0LBzrm+rA/+Bpq 0+XfbvkC6DX8wG/FxnBvr6GCF638UlXRRL0zoSM7qL9HVJLIYAq+fGrSyqXW+A== 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 D187B71AEE for ; Thu, 21 Nov 2024 15:25:57 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE6HA-0008Bd-B8; Thu, 21 Nov 2024 07:27:12 -0500 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 1tE6H2-0008AT-5b for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:04 -0500 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 1tE6H1-00025i-T2 for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 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=2179E/YnXyM8ZBbGZmXQ1H6HB96ZBNNJdJEakthEzjk=; b=At7mvQls+lJEbBFrDhyZ+V+XMEGv4g0UXBT9qzGCyRwq4S3BSLmhg+r0VOWL+p2D4186mQTm7lq2rLladqEalKDTp8p42SWWVE7TLUYnyRVMM3Jh4VTM9BR3rWTgC/v+aXyVEiLFOgmtedpvp6T74to3iXhaIa01+VChLycVtpGs6aBciGR/HyOAW/sae1mBEJ0hpGde075mvCbHr+iW4EexPudmza/PcUySfLmqSIEeVOMI/OIjAnP5g9KGRVsrApLJ5RONfKa8Pu7oMc/SNkPsn7rTuoXAubdqAsAPCkf56B2dnQuXFuMWZyaxOY+wMp0mRKoKvOyGTnNuICaHmQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE6H1-000890-O7 for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#42899] [PATCH v6 3/3] tests: dovecot: Add sieve. Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Nov 2024 12:27:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42899 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42899@debbugs.gnu.org Received: via spool by 42899-submit@debbugs.gnu.org id=B42899.173219197631214 (code B ref 42899); Thu, 21 Nov 2024 12:27:03 +0000 Received: (at 42899) by debbugs.gnu.org; 21 Nov 2024 12:26:16 +0000 Received: from localhost ([127.0.0.1]:49395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GF-00087I-Jj for submit@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:16 -0500 Received: from mail.mmer.org ([178.22.65.174]:58744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GC-00086V-6q for 42899@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:12 -0500 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id 3e5fba11 for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=dkim; bh=UbmnPpHQzLSxIROX3fbzqvygM WgSBEOfWq5L0axxHGQ=; b=Lg5HQWL2SY3R1X99BY1xcp+Xlbej1mV5Uv9IT71cf u7jcCMani9QSXhEgjcXuZoG70MJOUUKO8KH1q1DbcIkgQGW5cJSwdHDhYOv6aL7k nfzKpOytDQwIqzDR5jo98HD0i2V2Oww9hE3P46ZvghLCzhgY4DMCSOVhzIazd8LU CY= Received: from delta (142-212-98-95.ftth.glasoperator.nl [95.98.212.142]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id 01f15c1f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:25:59 +0000 (UTC) Date: Thu, 21 Nov 2024 12:25:58 +0000 Message-ID: <20241121122558.8617-4-levenson@mmer.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241121122558.8617-1-levenson@mmer.org> References: <20241121122558.8617-1-levenson@mmer.org> MIME-Version: 1.0 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: , Reply-to: Alexey Abramov X-ACL-Warn: , Alexey Abramov via Guix-patches From: Alexey Abramov via Guix-patches via 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-Spam-Score: -5.86 X-Spam-Score: -5.86 X-Migadu-Queue-Id: D187B71AEE X-Migadu-Scanner: mx10.migadu.com X-TUID: y48XHQzr0aHQ * gnu/tests/mail.scm (%dovecot-os): Add dovecot-pigeonhole and simple imapsieve configuration. * gnu/tests/mail.scm (run-dovecot-test): Define simple sieve script. Add SELECT TESTBOX step to let dovecot properly do mailbox synchronization. --- gnu/tests/mail.scm | 67 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 176e7c1d074..3b498b5b575 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -297,10 +297,42 @@ (define %dovecot-os (service dhcp-client-service-type) (service dovecot-service-type (dovecot-configuration + (extensions (list dovecot-pigeonhole)) (disable-plaintext-auth? #f) + ;; Required for sieve! + (postmaster-address "postmaster@komputilo") (ssl? "no") (auth-mechanisms '("anonymous")) (auth-anonymous-username "alice") + (protocols + (list (protocol-configuration + (name "imap") + (mail-plugins '("$mail_plugins" "imap_sieve")) + (imap-metadata? #t)))) + + (plugin-configuration + (plugin-configuration + (entries (list + (cons 'sieve-global "/tmp") + (cons 'sieve-extensions "+editheader") + + (cons 'imapsieve-mailbox1-name "*") + (cons 'imapsieve-mailbox1-causes "APPEND") + ;; Run the script *before* the user scripts + (cons 'imapsieve-mailbox1-before "file:/tmp/main.sieve") + ;; We want to automatically remove original email + (cons 'imapsieve-expunge-discarded "yes") + + (cons 'sieve-trace-debug "yes") + (cons 'sieve-trace-dir "/tmp") + (cons 'sieve-trace-level "tests") + (cons 'sieve-plugins "sieve_imapsieve") + ;; You cannot run scripts anywhere you want + ;; Sieve allows you to only run scripts under + ;; sieve_pipe_bin_dir. + (cons 'sieve-pipe-bin-dir "/tmp") + )))) + (mail-location (string-append "maildir:~/Maildir" ":INBOX=~/Maildir/INBOX" @@ -334,6 +366,18 @@ (define* (message-length message #:key (encoding "iso-8859-1")) (define message "From: test@example.com\n\ Subject: Hello Nice to meet you!") + (define sieve-script + "require \"editheader\";\n +addheader \"X-Sieve-Filtered\" \"Guix\"; +") + ;; Install our sieve script + (marionette-eval + `(begin + (with-output-to-file "/tmp/main.sieve" + (lambda () + (display ,sieve-script)))) + marionette) + (test-runner-current (system-test-runner #$output)) (test-begin "dovecot") @@ -367,6 +411,19 @@ (define message "From: test@example.com\n\ ;; Create a TESTBOX mailbox (write-line "a CREATE TESTBOX" imap) (read-line imap) ;OK + ;; Select mailbox. This is required so that dovecot did + ;; synchronization correctly. + (write-line "a SELECT TESTBOX" imap) + ;; ("* FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)\r") + ;; ("* OK [PERMANENTFLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft \\*)] Flags permitted.\r") + ;; ("* 1 EXISTS\r") + ;; ("* 1 RECENT\r") + ;; ("* OK [UNSEEN 1] First unseen.\r") + ;; ("* OK [UIDVALIDITY 1732177859] UIDs valid\r") + ;; ("* OK [UIDNEXT 3] Predicted next UID\r") + (for-each (lambda (n) + (read-line imap)) + (iota 7)) ;; Append a message to a TESTBOX mailbox (write-line (format #f "a APPEND TESTBOX {~a}" (number->string (message-length message))) @@ -380,18 +437,18 @@ (define message "From: test@example.com\n\ #t)) (test-equal "mail arrived" - message + (string-join (list "X-Sieve-Filtered: Guix" message) "\n") (marionette-eval '(begin (use-modules (ice-9 ftw) (ice-9 match) (rnrs io ports)) - - (let ((TESTBOX/new "/home/alice/Maildir/TESTBOX/new/")) - (match (scandir TESTBOX/new) + ;; XXX: We expect a new email in /cur directory + (let ((TESTBOX/cur "/home/alice/Maildir/TESTBOX/cur/")) + (match (scandir TESTBOX/cur) (("." ".." message-file) (call-with-input-file - (string-append TESTBOX/new message-file) + (string-append TESTBOX/cur message-file) get-string-all))))) marionette)) -- 2.46.0