mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-01 07:04:10 +01:00
test: change database from within pre-new hook
Due to the change in the config system, notmuch keeps a notmuch database open when it would not do so before. Consequently, it can miss changes to the database which are done from a hook (while notmuch holds the databse in read only mode). When notmuch itself writes to the database after that it uses wrong assumptions about the last used doc id etc. Demonstrate this by triggering an assertion. (This new test succeeds with notmuch 0.31.4.) Signed-off-by: Michael J Gruber <git@grubix.eu> Amended-by: db. Check for both messages
This commit is contained in:
parent
5ebbf17242
commit
0729c4e81f
1 changed files with 25 additions and 0 deletions
|
@ -28,6 +28,16 @@ EOF
|
||||||
echo "${TOKEN}" > ${2}
|
echo "${TOKEN}" > ${2}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_change_hook () {
|
||||||
|
mkdir -p ${HOOK_DIR}
|
||||||
|
cat <<EOF >"${HOOK_DIR}/${1}"
|
||||||
|
#!/bin/sh
|
||||||
|
notmuch insert --no-hooks < ${2} > /dev/null
|
||||||
|
rm -f ${2}
|
||||||
|
EOF
|
||||||
|
chmod +x "${HOOK_DIR}/${1}"
|
||||||
|
}
|
||||||
|
|
||||||
create_failing_hook () {
|
create_failing_hook () {
|
||||||
local HOOK_DIR=${2}
|
local HOOK_DIR=${2}
|
||||||
mkdir -p ${HOOK_DIR}
|
mkdir -p ${HOOK_DIR}
|
||||||
|
@ -176,6 +186,21 @@ EOF
|
||||||
NOTMUCH_NEW
|
NOTMUCH_NEW
|
||||||
test_expect_equal_file write.expected write.output
|
test_expect_equal_file write.expected write.output
|
||||||
|
|
||||||
|
test_begin_subtest "add message in pre-new [${config}]"
|
||||||
|
test_subtest_known_broken
|
||||||
|
rm -rf ${HOOK_DIR}
|
||||||
|
generate_message '[subject]="add msg in pre-new"'
|
||||||
|
id1=$gen_msg_id
|
||||||
|
create_change_hook "pre-new" $gen_msg_filename $HOOK_DIR
|
||||||
|
generate_message '[subject]="add msg in new"'
|
||||||
|
NOTMUCH_NEW
|
||||||
|
notmuch search id:$id1 or id:$gen_msg_id | notmuch_search_sanitize > OUTPUT
|
||||||
|
cat <<EOF | sed s'/^[ \t]*//' > EXPECTED
|
||||||
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; add msg in pre-new (inbox unread)
|
||||||
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; add msg in new (inbox unread)
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
rm -rf ${HOOK_DIR}
|
rm -rf ${HOOK_DIR}
|
||||||
done
|
done
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue