Skip to content

Commit

Permalink
clear db before every test (#1278)
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem authored Aug 30, 2023
1 parent ebd3fff commit b36039c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nucliadb/nucliadb/tests/integration/common/maindb/test_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,22 @@ async def test_local_driver(local_driver):
await driver_basic(local_driver)


async def _clear_db(driver: Driver):
all_keys = []
async with driver.transaction() as txn:
async for key in txn.keys("/"):
all_keys.append(key)

async with driver.transaction() as txn:
for key in all_keys:
await txn.delete(key)


async def driver_basic(driver: Driver):
await driver.initialize()

await _clear_db(driver)

# Test deleting a key that doesn't exist does not raise any error
txn = await driver.begin()
await txn.delete("/i/do/not/exist")
Expand Down

1 comment on commit b36039c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: b36039c Previous: a40981d Ratio
nucliadb/tests/benchmarks/test_search.py::test_search_returns_labels 74.33970249968185 iter/sec (stddev: 0.0004355968595361511) 60.779932309336715 iter/sec (stddev: 0.0019119907918232523) 0.82
nucliadb/tests/benchmarks/test_search.py::test_search_relations 187.83285968012513 iter/sec (stddev: 0.00009903804772949798) 182.57436721258293 iter/sec (stddev: 0.0002220745559283828) 0.97

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.