[PATCH 8/8] cli: optionally restore message properties from dump file
[notmuch-archives.git] / 51 / 586e8bc325e65df8c301b8e5bf136e6b8998ad
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id A5560431FBD\r
6         for <notmuch@notmuchmail.org>; Mon, 10 Mar 2014 22:43:00 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id n-A6yV6SKvIW for <notmuch@notmuchmail.org>;\r
16         Mon, 10 Mar 2014 22:42:56 -0700 (PDT)\r
17 Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com\r
18  [74.125.83.42])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  05DC0431FBC    for <notmuch@notmuchmail.org>; Mon, 10 Mar 2014 22:42:55 -0700\r
21  (PDT)\r
22 Received: by mail-ee0-f42.google.com with SMTP id d17so3517789eek.1\r
23         for <notmuch@notmuchmail.org>; Mon, 10 Mar 2014 22:42:53 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
27         :references;\r
28         bh=Gu/H19dmCFkJSL0o/SRMpDWMyaqtRCA9YYWJTIV2daw=;\r
29         b=WtooBge0VkGt6eo+Ux93Zf5gHRrFuSG/ADLKFzCbrbqTh9cB3dwLTTPv6yRExgnRDu\r
30         FCwoMPguIaRxG6+G3iAAPksg5iCWhxR0ECsH28fXwGNkz8sByOjjWQpY+tlGhJwB9wGo\r
31         W6tTSxKxLaQtL/lQTrY6c92gSTNys/TBKjPyQwCjObQTo6XIJfjtlImzmiWjySqRsOSy\r
32         a18aMGhPZZEaCM7vWGs5z8AWLpS6772jKKXshUz7buJfIEjbkMo9j0nBUIv34btBCYFn\r
33         bYxUtnANkloPjLYYLVkLY4sYP/rf1eDnhlpGBFZ9qKwqCHLGPpWWbO2n37Fxi+jvEDOR\r
34         xNnA==\r
35 X-Gm-Message-State:\r
36  ALoCoQlnxSmrf2oktcYHGzT+m6pGBLjn281CF1vfNSsGu5OXr5qt4jqKgSivQAdRo2D+ifV1TR+I\r
37 X-Received: by 10.14.204.9 with SMTP id g9mr1515106eeo.82.1394516571971;\r
38         Mon, 10 Mar 2014 22:42:51 -0700 (PDT)\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
40         [88.195.111.91]) by mx.google.com with ESMTPSA id\r
41         o43sm53367923eef.12.2014.03.10.22.42.50 for <multiple recipients>\r
42         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
43         Mon, 10 Mar 2014 22:42:51 -0700 (PDT)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: notmuch@notmuchmail.org\r
46 Subject: [PATCH v5] test: add database upgrade test from format version 1 to 2\r
47 Date: Tue, 11 Mar 2014 07:42:49 +0200\r
48 Message-Id: <1394516569-24036-1-git-send-email-jani@nikula.org>\r
49 X-Mailer: git-send-email 1.9.0\r
50 In-Reply-To: <87siqp7iki.fsf@zancas.localnet>\r
51 References: <87siqp7iki.fsf@zancas.localnet>\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Tue, 11 Mar 2014 05:43:00 -0000\r
65 \r
66 Test the upgrade from probabilistic to boolean folder: terms, and\r
67 addition of path: terms.\r
68 \r
69 The test depends on the pre-built test corpus and database tarball and\r
70 checksum file being in place. If it's not, the test is skipped. The\r
71 mechanism to fetch the test database will be added later.\r
72 \r
73 At the time of writing, a working test database and checksum file is\r
74 available at\r
75 \r
76    http://notmuchmail.org/releases/test-databases/\r
77 \r
78 It has been noted that some non-GNU environments make lack\r
79 sha256sum. We leave this portability issue for a followup patch.\r
80 \r
81 ---\r
82 \r
83 v5 of this patch, sneakily after Austin's "v5 LGTM" mail. ;)\r
84 \r
85 Fixed test to work with a database generated from the current\r
86 corpus. The rearrangement in patch 01 is slightly different from the\r
87 folders corpus in the earlier versions of the series (one more file,\r
88 two fewer dupes).\r
89 \r
90 David, please generate a database, verify it passes the test for you\r
91 too, and upload to notmuchmail.org. Thanks.\r
92 ---\r
93  test/T530-upgrade.sh | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++\r
94  1 file changed, 111 insertions(+)\r
95  create mode 100755 test/T530-upgrade.sh\r
96 \r
97 diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
98 new file mode 100755\r
99 index 000000000000..02d40f13b8ac\r
100 --- /dev/null\r
101 +++ b/test/T530-upgrade.sh\r
102 @@ -0,0 +1,111 @@\r
103 +#!/usr/bin/env bash\r
104 +test_description="database upgrade"\r
105 +\r
106 +. ./test-lib.sh\r
107 +\r
108 +dbtarball=folders-v1.tar.xz\r
109 +\r
110 +# XXX: Accomplish the same with test lib helpers\r
111 +if [ ! -e ${TEST_DIRECTORY}/test-databases/${dbtarball} ]; then\r
112 +    test_subtest_missing_external_prereq_["${dbtarball}"]=t\r
113 +fi\r
114 +\r
115 +test_expect_success \\r
116 +    'database checksum' \\r
117 +    '( cd $TEST_DIRECTORY/test-databases &&\r
118 +       sha256sum --quiet --check --status ${dbtarball}.sha256 )'\r
119 +\r
120 +tar xf $TEST_DIRECTORY/test-databases/${dbtarball} -C ${MAIL_DIR} --strip-components=1\r
121 +\r
122 +test_begin_subtest "folder: search does not work with old database version"\r
123 +output=$(notmuch search folder:foo)\r
124 +test_expect_equal "$output" ""\r
125 +\r
126 +test_begin_subtest "path: search does not work with old database version"\r
127 +output=$(notmuch search path:foo)\r
128 +test_expect_equal "$output" ""\r
129 +\r
130 +test_begin_subtest "database upgrade from format version 1"\r
131 +output=$(notmuch new)\r
132 +test_expect_equal "$output" "\\r
133 +Welcome to a new version of notmuch! Your database will now be upgraded.\r
134 +Your notmuch database has now been upgraded to database format version 2.\r
135 +No new mail."\r
136 +\r
137 +test_begin_subtest "folder: no longer matches in the middle of path"\r
138 +output=$(notmuch search folder:baz)\r
139 +test_expect_equal "$output" ""\r
140 +\r
141 +test_begin_subtest "folder: search"\r
142 +output=$(notmuch search --output=files folder:foo | notmuch_search_files_sanitize | sort)\r
143 +test_expect_equal "$output" "MAIL_DIR/foo/06:2,\r
144 +MAIL_DIR/foo/cur/07:2,\r
145 +MAIL_DIR/foo/cur/08:2,\r
146 +MAIL_DIR/foo/new/03:2,\r
147 +MAIL_DIR/foo/new/09:2,\r
148 +MAIL_DIR/foo/new/10:2,"\r
149 +\r
150 +test_begin_subtest "top level folder: search"\r
151 +output=$(notmuch search --output=files folder:'""' | notmuch_search_files_sanitize | sort)\r
152 +# bar/18:2, is a duplicate of cur/51:2,\r
153 +test_expect_equal "$output" "MAIL_DIR/01:2,\r
154 +MAIL_DIR/02:2,\r
155 +MAIL_DIR/bar/18:2,\r
156 +MAIL_DIR/cur/29:2,\r
157 +MAIL_DIR/cur/30:2,\r
158 +MAIL_DIR/cur/31:2,\r
159 +MAIL_DIR/cur/32:2,\r
160 +MAIL_DIR/cur/33:2,\r
161 +MAIL_DIR/cur/34:2,\r
162 +MAIL_DIR/cur/35:2,\r
163 +MAIL_DIR/cur/36:2,\r
164 +MAIL_DIR/cur/37:2,\r
165 +MAIL_DIR/cur/38:2,\r
166 +MAIL_DIR/cur/39:2,\r
167 +MAIL_DIR/cur/40:2,\r
168 +MAIL_DIR/cur/41:2,\r
169 +MAIL_DIR/cur/42:2,\r
170 +MAIL_DIR/cur/43:2,\r
171 +MAIL_DIR/cur/44:2,\r
172 +MAIL_DIR/cur/45:2,\r
173 +MAIL_DIR/cur/46:2,\r
174 +MAIL_DIR/cur/47:2,\r
175 +MAIL_DIR/cur/48:2,\r
176 +MAIL_DIR/cur/49:2,\r
177 +MAIL_DIR/cur/50:2,\r
178 +MAIL_DIR/cur/51:2,\r
179 +MAIL_DIR/cur/52:2,\r
180 +MAIL_DIR/cur/53:2,\r
181 +MAIL_DIR/new/04:2,"\r
182 +\r
183 +test_begin_subtest "path: search"\r
184 +output=$(notmuch search --output=files path:"bar" | notmuch_search_files_sanitize | sort)\r
185 +# cur/51:2, is a duplicate of bar/18:2,\r
186 +test_expect_equal "$output" "MAIL_DIR/bar/17:2,\r
187 +MAIL_DIR/bar/18:2,\r
188 +MAIL_DIR/cur/51:2,"\r
189 +\r
190 +test_begin_subtest "top level path: search"\r
191 +output=$(notmuch search --output=files path:'""' | notmuch_search_files_sanitize | sort)\r
192 +test_expect_equal "$output" "MAIL_DIR/01:2,\r
193 +MAIL_DIR/02:2,"\r
194 +\r
195 +test_begin_subtest "recursive path: search"\r
196 +output=$(notmuch search --output=files path:"bar/**" | notmuch_search_files_sanitize | sort)\r
197 +# cur/51:2, is a duplicate of bar/18:2,\r
198 +test_expect_equal "$output" "MAIL_DIR/bar/17:2,\r
199 +MAIL_DIR/bar/18:2,\r
200 +MAIL_DIR/bar/baz/05:2,\r
201 +MAIL_DIR/bar/baz/23:2,\r
202 +MAIL_DIR/bar/baz/24:2,\r
203 +MAIL_DIR/bar/baz/cur/25:2,\r
204 +MAIL_DIR/bar/baz/cur/26:2,\r
205 +MAIL_DIR/bar/baz/new/27:2,\r
206 +MAIL_DIR/bar/baz/new/28:2,\r
207 +MAIL_DIR/bar/cur/19:2,\r
208 +MAIL_DIR/bar/cur/20:2,\r
209 +MAIL_DIR/bar/new/21:2,\r
210 +MAIL_DIR/bar/new/22:2,\r
211 +MAIL_DIR/cur/51:2,"\r
212 +\r
213 +test_done\r
214 -- \r
215 1.9.0\r
216 \r