[PATCH v4 04/11] test: Tests for future version and unknown feature handling
authorAustin Clements <amdragon@mit.edu>
Mon, 25 Aug 2014 17:26:02 +0000 (13:26 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:04:19 +0000 (10:04 -0800)
26/4451ce83e9a95880fc3cce6751d49401bea207 [new file with mode: 0644]

diff --git a/26/4451ce83e9a95880fc3cce6751d49401bea207 b/26/4451ce83e9a95880fc3cce6751d49401bea207
new file mode 100644 (file)
index 0000000..ae6d02a
--- /dev/null
@@ -0,0 +1,139 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1438C431FD0\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Aug 2014 10:27:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id doSLJBXba7Y5 for <notmuch@notmuchmail.org>;\r
+       Mon, 25 Aug 2014 10:27:12 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu\r
+       [18.7.68.37])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8FA82431FD7\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Aug 2014 10:26:27 -0700 (PDT)\r
+X-AuditID: 12074425-f79e46d000002583-6f-53fb71c13024\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       (using TLS with cipher AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 3D.7E.09603.1C17BF35; Mon, 25 Aug 2014 13:26:25 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s7PHQEXZ014411; \r
+       Mon, 25 Aug 2014 13:26:14 -0400\r
+Received: from drake.dyndns.org (31-35-14.wireless.csail.mit.edu\r
+       [128.31.35.14]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s7PHQC9K029611\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 25 Aug 2014 13:26:13 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1XLy1z-0003jS-V6; Mon, 25 Aug 2014 13:26:11 -0400\r
+From: Austin Clements <amdragon@mit.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 04/11] test: Tests for future version and unknown feature\r
+       handling\r
+Date: Mon, 25 Aug 2014 13:26:02 -0400\r
+Message-Id: <1408987569-14146-5-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 2.0.0\r
+In-Reply-To: <1408987569-14146-1-git-send-email-amdragon@mit.edu>\r
+References: <1408987569-14146-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsUixG6nonuw8HewwfI3YhY3WrsZLZqmO1tc\r
+       vzmT2YHZ49b91+wez1bdYvbYcug9cwBzFJdNSmpOZllqkb5dAlfGmy9bWQquCVV0nU1pYLzJ\r
+       38XIwSEhYCJx7HhIFyMnkCkmceHeejYQW0hgNpPEilnOXYxcQPZGRok3h7exQzjHmCSmfJjG\r
+       CuHMZZQ4+ucYM0gLm4CGxO9bi5lAbBEBaYmdd2ezgtjMAl4Syy70g9nCAqESkzuOgtWzCKhK\r
+       9E36yQJi8wo4SKy7OokZ4gw5iYYbn8DO4BRwlJi+cDYTxEkOEt8vn2eewMi/gJFhFaNsSm6V\r
+       bm5iZk5xarJucXJiXl5qka6FXm5miV5qSukmRnBguajuYJxwSOkQowAHoxIP743438FCrIll\r
+       xZW5hxglOZiURHmn5QOF+JLyUyozEosz4otKc1KLDzFKcDArifA2g+R4UxIrq1KL8mFS0hws\r
+       SuK8b62tgoUE0hNLUrNTUwtSi2CyMhwcShK8uQVAjYJFqempFWmZOSUIaSYOTpDhPEDD40Fq\r
+       eIsLEnOLM9Mh8qcYdTkmbXzfyyTEkpeflyolzvsfpEgApCijNA9uDiwhvGIUB3pLmPcoSBUP\r
+       MJnATXoFtIQJaIlpz0+QJSWJCCmpBsa+Ep0fgl6Oa+NCOnoYjbjWiHloKmYvXbNs3c7oK7Pm\r
+       L2byqk0NfX7Sg+nnZRm3hq2Wc23vbtr4+eOkj46nGpOOubPaieTdjAq6di61/vouhtdBVZxf\r
+       H95RF7zWPqerTuK66DbOE1Fd5tP2XjfQey1Zd0G7coaX8Q6D1XXKi7dfybfST987JV2JpTgj\r
+       0VCLuag4EQAxhIiy4wIAAA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 25 Aug 2014 17:27:18 -0000\r
+\r
+---\r
+ test/T550-db-features.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++\r
+ 1 file changed, 48 insertions(+)\r
+ create mode 100755 test/T550-db-features.sh\r
+\r
+diff --git a/test/T550-db-features.sh b/test/T550-db-features.sh\r
+new file mode 100755\r
+index 0000000..5569768\r
+--- /dev/null\r
++++ b/test/T550-db-features.sh\r
+@@ -0,0 +1,48 @@\r
++#!/usr/bin/env bash\r
++test_description="database version and feature compatibility"\r
++\r
++. ./test-lib.sh\r
++\r
++test_begin_subtest "future database versions abort open"\r
++${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 9999 ""\r
++output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++test_expect_equal "$output" "\\r
++Error: Notmuch database at FILENAME\r
++       has a newer database format version (9999) than supported by this\r
++       version of notmuch (3)."\r
++\r
++test_begin_subtest "unknown 'rw' feature aborts read/write open"\r
++${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\trw'\r
++output=$(notmuch new 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++test_expect_equal "$output" "\\r
++Error: Notmuch database at FILENAME\r
++       requires features (test feature)\r
++       not supported by this version of notmuch."\r
++\r
++test_begin_subtest "unknown 'rw' feature aborts read-only open"\r
++${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\trw'\r
++output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++test_expect_equal "$output" "\\r
++Error: Notmuch database at FILENAME\r
++       requires features (test feature)\r
++       not supported by this version of notmuch."\r
++\r
++test_begin_subtest "unknown 'w' feature aborts read/write open"\r
++${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\tw'\r
++output=$(notmuch new 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++test_expect_equal "$output" "\\r
++Error: Notmuch database at FILENAME\r
++       requires features (test feature)\r
++       not supported by this version of notmuch."\r
++\r
++test_begin_subtest "unknown 'w' feature does not abort read-only open"\r
++${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\tw'\r
++output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/')\r
++rm -rf ${MAIL_DIR}/.notmuch\r
++test_expect_equal "$output" ""\r
++\r
++test_done\r
+-- \r
+2.0.0\r
+\r