From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EJj0KwNeBGBBKQAA0tVLHw (envelope-from ) for ; Sun, 17 Jan 2021 15:55:47 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iKTdJwNeBGDqaQAAB5/wlQ (envelope-from ) for ; Sun, 17 Jan 2021 15:55:47 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 825919402D4 for ; Sun, 17 Jan 2021 15:55:45 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id C76DC29C96; Sun, 17 Jan 2021 10:55:36 -0500 (EST) Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [IPv6:2a0b:5c81:1c1::37]) by mail.notmuchmail.org (Postfix) with ESMTPS id 08C0E1FF9D for ; Sun, 17 Jan 2021 10:55:33 -0500 (EST) Received: from guru.guru-group.fi (unknown [IPv6:2a02:2380:1:9:5054:ff:feb7:a4bc]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id A24AF1B0036E; Sun, 17 Jan 2021 17:55:29 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1610898929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DDGnxWO46LW28tv5OVJr02yn11FNUZPL5iASqeZgd/g=; b=a9W9SjTm91iTKnCQKp8HlY41gdsVZxfE/WMit8VIfFxT/ZxF86f5U9LT4r5ekQhtOxZNfA WZclD1fphSzky7Q2KufDm13ua1svDwJ3srav7rYXM7dheTPeNpeVW00gbFKQDeMR65wwKS WbAR6MTqxsdXNloOlbdCQIn8QXNPwI99ZLxFSdl5+Z/6v/uNAZ5kvSKVj7I5yGNygagAJ9 d5jxYzhj9gpmgElBWlTzHj7i+N2jeV/5HJRmL7FULqh9ZX3dVCEeRQBbsdn4DtkvQrmvPm r6RmOiPW3+fmSnWNoykje7hE0eVmuxVPtQ8PmyTJ5z9oZ3D87eiEq1A+qLqH9Q== From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] test: add (back) upgrade tests In-Reply-To: <20210117124712.1298562-1-david@tethera.net> References: <20210117124712.1298562-1-david@tethera.net> User-Agent: Notmuch/0.31.3+85~g92bd77f (https://notmuchmail.org) Emacs/27.1 X-Face: HhBM'cA~ MIME-Version: 1.0 ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1610898929; a=rsa-sha256; cv=none; b=O/7djkHbfPWtB8m8ODzE90vq77A+lx36eLI8/LOYuVjd08288kiKnk73LcN5mPjyPzrSnE IdBuBtL1X7MaVDYQYx4mpm+5FxMjOV+mSpQn1Ng9fZ+1mQrRTQele2c/GmOG0j5VS9Orha R3ufPs++gYmqwfug+BDo+W8b9wwECutPI0l8wb1W8sbv5wtZGX3QsWcnI4liAv85PGuFmZ zPOm8Yy14D7z2CHoK987KWg6RfHLQe7IQSo9yjycUN7kc88oCus9c4jwm8ewgMhlEiMeDO piiH11Je3YH7uvnc0nN49fLjfPWu46uwB++N+GZ2bDI++jyXYdfPj4z+lQ2U4w== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1610898929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DDGnxWO46LW28tv5OVJr02yn11FNUZPL5iASqeZgd/g=; b=kNzwOcrKfvPbmGiFt24ANIaYXCIjkySPWQqmkbgYBRuhD4eSgHHEUgLCItjS2AIa1zvGKM 9HbaPSqiiPMgnaQxYvfdTSsKAaUEeK3KQ71UEkZgnDkFQp2NWh1jjhB4Gr7X7THVQPOGmK PWEwWG9ZSnD+i37QVtcx0Moav+w807dz5o9u76ewu+ADiQYvXg1ovwrom4juKLeEQHGLkP EzL9KzlJOJLyI1vqPhnl40VR6uoNjeCVjDbkDqBllyQfx7r7+Ag3Jhj0xn/91rt5OoACri /l/U4NyH6VbtK6X5spaIudeCpcyirXNIRPf8zD5jezZXWHWAYxhrpo3WR/peRQ== Message-ID-Hash: VEM33VVKY2ZSX4XJGNCDJID5E5QPVSA6 X-Message-ID-Hash: VEM33VVKY2ZSX4XJGNCDJID5E5QPVSA6 X-MailFrom: tomi.ollila@iki.fi 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 1.11 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=a9W9SjTm; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 825919402D4 X-Spam-Score: 1.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: YnI5HL12W+Cz On Sun, Jan 17 2021, David Bremner wrote: > In ee897cab8b721 the upgrade tests from pre v3 databases were > removed. The reasons for that are still valid, but we should still > test the code paths that do the upgrade, and it is relatively > straightforward to do that for v3 to v3 upgrades. > --- > test/README | 1 + > test/T530-upgrade.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++ > test/test-lib.sh | 1 + > 3 files changed, 53 insertions(+) > create mode 100755 test/T530-upgrade.sh > > diff --git a/test/README b/test/README > index 11eaf18f..10f127cb 100644 > --- a/test/README > +++ b/test/README > @@ -25,6 +25,7 @@ that you know if you break anything. > - gdb(1) > - gpg(1) > - python(1) > + - xapian-metadata(1) > > If your system lacks these tools or have older, non-upgradable versions > of these, please (possibly compile and) install these to some other > diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh > new file mode 100755 > index 00000000..bdd8d282 > --- /dev/null > +++ b/test/T530-upgrade.sh > @@ -0,0 +1,51 @@ > +#!/usr/bin/env bash > +test_description='database upgrades' > +. $(dirname "$0")/test-lib.sh || exit 1 > + > +test_require_external_prereq xapian-metadata > + > +XAPIAN_PATH=$MAIL_DIR/.notmuch/xapian > +BACKUP_PATH=$MAIL_DIR/.notmuch > + > +delete_feature () { > + local key=$1 > + features=$(xapian-metadata get $XAPIAN_PATH features | grep -v "^$key") > + xapian-metadata set $XAPIAN_PATH features "$features" > +} > + > +add_email_corpus > + > +for key in 'multiple paths per message' 'relative directory paths' 'exact folder:/path: search' \ could be split "earlier" so that this fits into 80 columns... > + 'mail documents for missing messages' \ > + 'modification tracking'; do > + backup_database > + test_begin_subtest "upgrade is triggered by missing '$key'" > + delete_feature "$key" > + output=$(notmuch new | grep Welcome) > + test_expect_equal "$output" "Welcome to a new version of notmuch! Your database will now be upgraded." (here we have to tolerate long line) > + restore_database > + > + backup_database > + test_begin_subtest "backup can be restored ['$key']" > + notmuch dump > BEFORE > + delete_feature "$key" > + notmuch new | grep "\(Welcome\|backup\)" > OUTPUT could do grep -e Welcome -e backup (but above is fine too) > + notmuch tag -inbox '*' > + dump_file=$(ls ${BACKUP_PATH}/dump*) $(echo ${BACKUP_PATH}/dump*) (so using shell builtin instead of external command) > + notmuch restore --input=$dump_file >> OUTPUT > + notmuch dump > AFTER > + test_expect_equal_file BEFORE AFTER > + restore_database > + > +done > + > +for key in 'from/subject/message-ID in database' 'indexed MIME types' 'index body and headers separately'; do clould be split "earlier" so lines fit into 80 columns > + backup_database > + test_begin_subtest "upgrade not triggered by missing '$key'" > + delete_feature "$key" > + output=$(notmuch new | grep Welcome) > + test_expect_equal "$output" "" > + restore_database > +done > + > +test_done > diff --git a/test/test-lib.sh b/test/test-lib.sh > index c23a0d20..29baa0c1 100644 > --- a/test/test-lib.sh > +++ b/test/test-lib.sh > @@ -1270,3 +1270,4 @@ test_declare_external_prereq gpg > test_declare_external_prereq openssl > test_declare_external_prereq gpgsm > test_declare_external_prereq ${NOTMUCH_PYTHON} > +test_declare_external_prereq xapian-metadata > -- > 2.29.2 > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org