2 test_description='database upgrades'
3 . $(dirname "$0")/test-lib.sh || exit 1
5 test_require_external_prereq xapian-metadata
7 XAPIAN_PATH=$MAIL_DIR/.notmuch/xapian
8 BACKUP_PATH=$MAIL_DIR/.notmuch
12 features=$(xapian-metadata get $XAPIAN_PATH features | grep -v "^$key")
13 xapian-metadata set $XAPIAN_PATH features "$features"
18 for key in 'multiple paths per message' \
19 'relative directory paths' \
20 'exact folder:/path: search' \
21 'mail documents for missing messages' \
22 'modification tracking'; do
24 test_begin_subtest "upgrade is triggered by missing '$key'"
26 output=$(notmuch new | grep Welcome)
29 "Welcome to a new version of notmuch! Your database will now be upgraded."
34 test_begin_subtest "backup can be restored ['$key']"
38 notmuch tag -inbox '*'
39 dump_file=$(echo ${BACKUP_PATH}/dump*)
40 notmuch restore --input=$dump_file
42 test_expect_equal_file BEFORE AFTER
46 for key in 'from/subject/message-ID in database' \
47 'indexed MIME types' \
48 'index body and headers separately'; do
50 test_begin_subtest "upgrade not triggered by missing '$key'"
52 output=$(notmuch new | grep Welcome)
53 test_expect_equal "$output" ""