[PATCH 5/5] test: add database upgrade test from format version 1

Jani Nikula jani at nikula.org
Thu Jan 9 14:18:36 PST 2014


---
 test/notmuch-test |  1 +
 test/upgrade      | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100755 test/upgrade

diff --git a/test/notmuch-test b/test/notmuch-test
index d6fdd3a..68c8ad9 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -69,6 +69,7 @@ TESTS="
   parse-time-string
   search-date
   thread-replies
+  upgrade
 "
 TESTS=${NOTMUCH_TESTS:=$TESTS}
 
diff --git a/test/upgrade b/test/upgrade
new file mode 100755
index 0000000..edee35d
--- /dev/null
+++ b/test/upgrade
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+test_description="database upgrade"
+
+. ./test-lib.sh
+
+tar zxf $TEST_DIRECTORY/test-databases/database-v1.tar.gz -C ${MAIL_DIR} --strip-components=1
+
+# XXX: Test new notmuch with old database in read-only mode
+
+test_begin_subtest "database upgrade from format version 1"
+output=$(notmuch new)
+test_expect_equal "$output" "\
+Welcome to a new version of notmuch! Your database will now be upgraded.
+Your notmuch database has now been upgraded to database format version 2.
+No new mail."
+
+# XXX: Add some meaningful tests on the upgraded database, testing the
+# things that have been upgraded. For folder search, this means
+# actually having folders in the corpus.
+
+test_begin_subtest "Top level folder"
+output=$(notmuch search folder:'""' | notmuch_search_sanitize)
+test_expect_equal "$output" ""
+
+test_done
-- 
1.8.5.2



More information about the notmuch mailing list