aboutsummaryrefslogtreecommitdiff
path: root/test/T562-lib-database.sh
AgeCommit message (Collapse)Author
2022-06-25lib: add NOTMUCH_STATUS_CLOSED_DATABASE, use in _n_d_ensure_writableDavid Bremner
In order for a database to actually be writeable, it must be the case that it is open, not just the correct type of Xapian object. By explicitely checking, we are able to provide better error reporting, in particular for the previously broken test in T566-lib-message.
2022-05-29test: replace deprecated use of notmuch_database_open_verboseDavid Bremner
We need to do it some day, and it is a bit annoying to read deprecation messages in broken tests.
2021-12-23test: remove directory names from paths in exceptionsDavid Bremner
These cause failures when building out of tree.
2021-12-04test: move system includes to notmuch-test.hDavid Bremner
This removes some redudant includes, and will also make it easier to introduce "#define _GNU_SOURCE", which must come before all system includes.
2021-03-12test: clean up some extra whitespace.David Bremner
The extra space is mainly just untidy.
2021-02-06lib: add stub for notmuch_database_open_with_configDavid Bremner
Initially document the intended API and copy the code from notmuch_database_open_verbose. Most of the documented functionality is not there yet.
2021-02-06lib: cache configuration information from databaseDavid Bremner
The main goal is to allow configuration information to be temporarily overridden by a separate config file. That will require further changes not in this commit. The performance impact is unclear, and will depend on the balance between number of queries and number of distinct metadata items read on the first call to n_d_get_config.
2020-08-16test: fix uninitialized variable use in T562-lib-databaseDavid Bremner
Fix a copy paste error of using the boolean ret as a notmuch_status_t, and uninitialized.
2020-08-03test: regression tests for n_indexopts_{get,set}_decrypt_policyDavid Bremner
The main criteria is that they don't crash. Working with a closed database is a bonus.
2020-08-03lib: return NULL from n_d_get_default_indexopts on errorDavid Bremner
This is a rare and probably serious programming error, so better not to silently return a default value.
2020-07-22test: add known broken test for n_d_get_default_indexoptsDavid Bremner
Xapian exceptions are swallowed and turned into default return value.
2020-07-22lib: fix error return bug with n_d_set_config.David Bremner
The catch block either needs to return, or the function needs to return "status". Choose the latter for consistency with n_d_get_config.
2020-07-22test: add known broken test for n_d_set_configDavid Bremner
Error status is currently lost.
2020-07-22test: add regression test for n_d_get_configDavid Bremner
Xapian exceptions seem to handled OK, at least for this case.
2020-07-22lib: add regresion test for n_d_get_all_tagsDavid Bremner
Existing error handling seems adequate, if not ideal.
2020-07-22lib: add regression test for n_d_find_message_by_filenameDavid Bremner
At least this Xapian exception is caught. Make sure it stays that way.
2020-07-22lib: rename _n_d_create to _n_d_find_or_createDavid Bremner
The error message and name were confusing when called in some "read only" context.
2020-07-22test: add known broken test for notmuch_database_remove_messageDavid Bremner
The current error message is a bit confusing; fix in next commit.
2020-07-22lib: convert relative filenames to absolute in n_d_index_fileDavid Bremner
The API docs promise to handle relative filenames, but the code did not do it. Also check for files outside the mail root, as implied by the API description. This fixes the bug reported at id:87sgdqo0rz.fsf@tethera.net
2020-07-22test: add known broken test for indexing relative pathDavid Bremner
The current code seems to look for the path relative to the current working directory, rather than the mail store root.
2020-07-22test: regression test for n_d_index_file closed dbDavid Bremner
Current exception handling seems OK, at least for this case.
2020-07-22test: add regression test for n_d_get_directoryDavid Bremner
At least this exception is already handled correctly.
2020-07-22test: regression test for n_d_get_revisionDavid Bremner
This function only accesses data cached by notmuch, so being closed is not a problem.
2020-07-22test: add regression test for n_d_{begin,end}_atomicDavid Bremner
Xapian currently succeeds to begin/end a transaction on a closed database, or at least does not throw an exception. Make the test robust against this changing.
2020-07-22test: regression test for n_d_upgradeDavid Bremner
The logic is that if it's acceptable to return SUCCESS for read only database, it's acceptable for a closed one.
2020-07-22lib/n_d_needs_upgrade: handle error return from n_d_get_versionDavid Bremner
Also clarify documentation of error return from n_d_needs_upgrade.
2020-07-22test: add known broken test for n_d_needs_upgradeDavid Bremner
It's a bit arbitrary which value to return for errors, but the same argument as for read only databases applies for errors.
2020-07-22test: add regression tests for notmuch database destroyDavid Bremner
Either an open or closed database should be ok to destroy
2020-07-22test: regression test for closing a closed databaseDavid Bremner
This does not currently throw an error, and it should stay that way.
2020-07-22lib/n_d_get_version: catch exceptions and clarify the APIDavid Bremner
notmuch_database_get_version previously returned 0 on some errors, but did not document this. Luckily 0 is not a valid database version.
2020-07-22test: add known broken test for n_d_get_version on closed dbDavid Bremner
This should not crash, but it does currently.
2020-07-22test: regression tests for n_d_status_string and n_d_get_pathDavid Bremner
These do not crash on a closed database, and we want to keep it that way. Start a new file of tests as T560-lib-error was starting to get unwieldy.