Skip to content

Commit

Permalink
test: add test for offset2ids saving and loading (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
jemmyshin authored Feb 8, 2023
1 parent 906ed7d commit a2519f0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/executor/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,3 +372,34 @@ def test_local_storage_with_shards(tmpfile):
index_size += stat.tags['index_size']
assert total_docs == N
assert index_size == N


def test_local_storage_with_delete(tmpfile):
docs = gen_docs(N)
f = Flow().add(
uses=AnnLiteIndexer,
uses_with={
'n_dim': D,
},
workspace=tmpfile,
shards=1,
)
with f:
f.post(on='/index', inputs=docs)
time.sleep(2)
f.post(on='/backup')
time.sleep(2)

f = Flow().add(
uses=AnnLiteIndexer,
uses_with={'n_dim': D},
workspace=tmpfile,
shards=1,
)
with f:
f.post(on='/restore')
f.post(on='/delete', parameters={'ids': ['0']})
status = f.post(on='/status', return_results=True)[0]

assert int(status.tags['total_docs']) == N - 1
assert int(status.tags['index_size']) == N - 1

0 comments on commit a2519f0

Please sign in to comment.