[PATCH v2 07/14] test: Tests for future version and unknown feature handling
--- test/T550-db-features.sh | 48 1 file changed, 48 insertions(+) create mode 100755 test/T550-db-features.sh diff --git a/test/T550-db-features.sh b/test/T550-db-features.sh new file mode 100755 index 000..5569768 --- /dev/null +++ b/test/T550-db-features.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +test_description="database version and feature compatibility" + +. ./test-lib.sh + +test_begin_subtest "future database versions abort open" +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} "" +output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal "$output" "\ +Error: Notmuch database at FILENAME + has a newer database format version () than supported by this + version of notmuch (3)." + +test_begin_subtest "unknown 'rw' feature aborts read/write open" +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\trw' +output=$(notmuch new 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal "$output" "\ +Error: Notmuch database at FILENAME + requires features (test feature) + not supported by this version of notmuch." + +test_begin_subtest "unknown 'rw' feature aborts read-only open" +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\trw' +output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal "$output" "\ +Error: Notmuch database at FILENAME + requires features (test feature) + not supported by this version of notmuch." + +test_begin_subtest "unknown 'w' feature aborts read/write open" +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\tw' +output=$(notmuch new 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal "$output" "\ +Error: Notmuch database at FILENAME + requires features (test feature) + not supported by this version of notmuch." + +test_begin_subtest "unknown 'w' feature does not abort read-only open" +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\tw' +output=$(notmuch search x 2>&1 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal "$output" "" + +test_done -- 2.0.0
[PATCH v2 07/14] test: Tests for future version and unknown feature handling
--- test/T550-db-features.sh | 48 1 file changed, 48 insertions(+) create mode 100755 test/T550-db-features.sh diff --git a/test/T550-db-features.sh b/test/T550-db-features.sh new file mode 100755 index 000..5569768 --- /dev/null +++ b/test/T550-db-features.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +test_description=database version and feature compatibility + +. ./test-lib.sh + +test_begin_subtest future database versions abort open +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} +output=$(notmuch search x 21 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal $output \ +Error: Notmuch database at FILENAME + has a newer database format version () than supported by this + version of notmuch (3). + +test_begin_subtest unknown 'rw' feature aborts read/write open +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\trw' +output=$(notmuch new 21 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal $output \ +Error: Notmuch database at FILENAME + requires features (test feature) + not supported by this version of notmuch. + +test_begin_subtest unknown 'rw' feature aborts read-only open +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\trw' +output=$(notmuch search x 21 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal $output \ +Error: Notmuch database at FILENAME + requires features (test feature) + not supported by this version of notmuch. + +test_begin_subtest unknown 'w' feature aborts read/write open +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\tw' +output=$(notmuch new 21 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal $output \ +Error: Notmuch database at FILENAME + requires features (test feature) + not supported by this version of notmuch. + +test_begin_subtest unknown 'w' feature does not abort read-only open +${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 3 $'test feature\tw' +output=$(notmuch search x 21 | sed 's/\(database at\) .*/\1 FILENAME/') +rm -rf ${MAIL_DIR}/.notmuch +test_expect_equal $output + +test_done -- 2.0.0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch