unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob bdd8d2825ebb338400a80d4a52de3feaec422bf2 1589 bytes (raw)
name: test/T530-upgrade.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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' \
					'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."
    restore_database

    backup_database
    test_begin_subtest "backup can be restored ['$key']"
    notmuch dump > BEFORE
    delete_feature "$key"
    notmuch new | grep "\(Welcome\|backup\)" > OUTPUT
    notmuch tag -inbox '*'
    dump_file=$(ls ${BACKUP_PATH}/dump*)
    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
    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

debug log:

solving bdd8d282 ...
found bdd8d282 in https://yhetil.org/notmuch/20210117124712.1298562-1-david@tethera.net/

applying [1/1] https://yhetil.org/notmuch/20210117124712.1298562-1-david@tethera.net/
diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh
new file mode 100755
index 00000000..bdd8d282

Checking patch test/T530-upgrade.sh...
Applied patch test/T530-upgrade.sh cleanly.

index at:
100755 bdd8d2825ebb338400a80d4a52de3feaec422bf2	test/T530-upgrade.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).