summaryrefslogtreecommitdiff
path: root/lib/ldb/tests/python/api_search.py
AgeCommit message (Collapse)AuthorFilesLines
2024-09-24ldb:test:api_search: shift remaining setUp adds to class add_indexDouglas Bagnall1-35/+31
Before: ldb.python.api_search -> 52 ldb.python.api_search.tr -> 48 After: ldb.python.api_search.tr -> 10 ldb.python.api_search -> 9 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Sep 24 10:38:03 UTC 2024 on atb-devel-224
2024-09-24ldb:test:api_search: remove pass-through setUp()sDouglas Bagnall1-9/+0
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:test:api_search: use @unittest.skipIf for LMDB testsDouglas Bagnall1-37/+8
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:test:api_search: skip LMDB tests at class levelDouglas Bagnall1-18/+25
LMDB is not going to turn up midway through the testsuite, so we might as well skip the whole class Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:test:api_search: use class method to add indexDouglas Bagnall1-21/+56
The index attribute of these classes was a mutable object, which made me nervous. If a subclass were to alter the class.index (rather than replace it), it would affect tests in other subclasses. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:test:api_search: tidy up files in each subclassDouglas Bagnall1-2/+8
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:test:api_search: set up the database once and use copiesDouglas Bagnall1-210/+224
The api_search tests are really slow, in part because we populate the database identically for all the individual tests. We can instead do it once and use copies. This makes the test several times faster. Comparing "make test TESTS=ldb.python": Before: TOP 10 slowest tests ldb.python.api_search.tr -> 415 ldb.python.api_search -> 413 ldb.python.api_add_modify -> 5 ldb.python.api_add_modify.tr -> 4 ldb.python.index.tr -> 4 ldb.python.index -> 4 ldb.python.api_simple.tr -> 2 ldb.python.api_simple -> 2 ldb.python.repack -> 2 ldb.python.api_misc.tr -> 1 'testonly' finished successfully (14m13.276s) After: TOP 10 slowest tests ldb.python.api_search.tr -> 52 ldb.python.api_search -> 50 ldb.python.api_add_modify -> 7 ldb.python.api_add_modify.tr -> 7 ldb.python.index.tr -> 4 ldb.python.index -> 4 ldb.python.api_simple -> 4 ldb.python.api_simple.tr -> 2 ldb.python.repack -> 2 ldb.python.api_misc -> 1 'testonly' finished successfully (2m14.505s) Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:test:api_search: use test name as db nameDouglas Bagnall1-2/+6
This will help enusre we are using the right DB when (in the next commit) we set up the database for each test via copy. It also helps with debugging. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:test:api_search: put config options on class, not instance.Douglas Bagnall1-47/+44
This makes them available to class methods. In a later commit we will convert the index attribute into an add_index() class method, because having a mutable variable on a class is a slightly bad idea. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:test:api_search: improve attribute access testsDouglas Bagnall1-3/+3
`list = res.msgs` tests nothing more than a bare `res.msgs`, and we can instead assert that the result is a list. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-09-24ldb:tests: make api_search moduleDouglas Bagnall1-0/+1720
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>