From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gFfZK1lQyGFBUQAAgWs5BA (envelope-from ) for ; Sun, 26 Dec 2021 12:22:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SMqTJ1lQyGGyfAAAB5/wlQ (envelope-from ) for ; Sun, 26 Dec 2021 11:22:01 +0000 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0D3353144F for ; Sun, 26 Dec 2021 12:22:01 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6DB3F5F721; Sun, 26 Dec 2021 11:21:56 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 80C0F5F527 for ; Sun, 26 Dec 2021 11:21:53 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 4126C5FC42; Sun, 26 Dec 2021 06:21:52 -0500 (EST) Received: (nullmailer pid 1958407 invoked by uid 1000); Sun, 26 Dec 2021 11:21:51 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH] test: test folder renames Date: Sun, 26 Dec 2021 07:21:42 -0400 Message-Id: <20211226112142.1958395-1-david@tethera.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Message-ID-Hash: KYDYVWYGMDUTOSEGOVAQKPMEOEFIZA6D X-Message-ID-Hash: KYDYVWYGMDUTOSEGOVAQKPMEOEFIZA6D X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640517721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=57koc+1jJ7ZYVdS6vgHOMHM6wz55jeO8Pq0BFtbSf/Y=; b=ffELkJ3QcFbONKydrYZvMOpt/tdqWxIi9Vwl7D1UtRFow1MZHYGbiSyKZgFMCIBlcaCfjR Lxww42AeEoqow+2R9L+kH192hnnuEzD4KK6N1gh6AfTjSMl46w//ipLxxwA2MKN299L4F6 ieeiONTR4RY5f/DR4QTBOlmy8dYcYt7MbFR756HQhRxTkfXlTW5LdpvcnE/ofpGX6iOkSv 382Z1AIkDQGFOUHfVj8jflJHZsugCivP+aawMM7acVaMDZkUJK1+8wl/xucSYweJZubLp+ M47tAz8f2CUomo7MLn/2qLEe5WyzuTTaBzyEUH3jsv8HShZH42B5O8aPO/gdDQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640517721; a=rsa-sha256; cv=none; b=DYwmRQJZPwoK6BDWpetYrzYKgf1AkhKWA3TfqSetYRhCXZ6gVff1POlYSkZBXjcvzfkeZH Cv2VTpTUaZ8YB13YV2394AVR2eJ6sLWUl547Jv3c9Q8QaMZLoqq+Brll+DoDp0sq0eLdYo buMR9zht4r/LC84kYCIpEal+h0bDk9RIfG2+mOYSRXBTXbKAMyUcA4yvwoM3/XHvvGOnVk xKN7DQMCYsU1HXo9zeG/zk7+hpkTKv50SW0GRQ31av/k4OO7EZ6DGludp+YvahIjgb4WUe Ba7I+tE1fJ4YAvU8cxVUni7uoDT8lfPB2hmUEz/QNIKMYLwBhtD6biqkKf57sg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.17 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 0D3353144F X-Spam-Score: -2.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2Gt1Mhru9iE9 From: Jani Nikula In [1] Mark Walters reported a problem with messages being removed from the database when the parent directory was renamed. Jani Nikula proposed [2] these tests but observed This test is not suitable for merging since it's not deterministic. After applying Jani's patch [3], the tests now pass deterministically, and could usefully act as regression tests. [1]: id:87siray6th.fsf@qmul.ac.uk [2]: id:1393191650-28333-1-git-send-email-jani@nikula.org [3]: id:1441445731-4362-2-git-send-email-jani@nikula.org --- test/T051-new-renames.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 test/T051-new-renames.sh diff --git a/test/T051-new-renames.sh b/test/T051-new-renames.sh new file mode 100755 index 00000000..febe006f --- /dev/null +++ b/test/T051-new-renames.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +test_description='"notmuch new" with directory renames' +. ./test-lib.sh + +for loop in `seq 10`; do + +rm -rf ${MAIL_DIR} + +for i in `seq 10`; do + generate_message '[dir]=foo' '[subject]="Message foo $i"' +done + +for i in `seq 10`; do + generate_message '[dir]=bar' '[subject]="Message bar $i"' +done + +test_begin_subtest "Index the messages, round $loop" +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "Added 20 new messages to the database." + +all_files=$(notmuch search --output=files \*) +count_foo=$(notmuch count folder:foo) + +test_begin_subtest "Rename folder" +mv ${MAIL_DIR}/foo ${MAIL_DIR}/baz +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "No new mail. Detected $count_foo file renames." + +test_begin_subtest "Rename folder back" +mv ${MAIL_DIR}/baz ${MAIL_DIR}/foo +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "No new mail. Detected $count_foo file renames." + +test_begin_subtest "Files remain the same" +output=$(notmuch search --output=files \*) +test_expect_equal "$output" "$all_files" + +done + +test_done -- 2.34.1