(repository)
| 278 | |
| 279 | |
| 280 | def test_uncommitted_garbage(repository): |
| 281 | with repository: |
| 282 | # uncommitted garbage should be no problem, it is cleaned up automatically. |
| 283 | # we just have to be careful with invalidation of cached FDs in LoggedIO. |
| 284 | repository.put(H(0), fchunk(b"foo")) |
| 285 | repository.commit(compact=False) |
| 286 | # write some crap to an uncommitted segment file |
| 287 | last_segment = repository.io.get_latest_segment() |
| 288 | with open(repository.io.segment_filename(last_segment + 1), "wb") as f: |
| 289 | f.write(MAGIC + b"crapcrapcrap") |
| 290 | with reopen(repository) as repository: |
| 291 | # usually, opening the repo and starting a transaction should trigger a cleanup. |
| 292 | repository.put(H(0), fchunk(b"bar")) # this may trigger compact_segments() |
| 293 | repository.commit(compact=True) |
| 294 | # the point here is that nothing blows up with an exception. |
| 295 | |
| 296 | |
| 297 | def test_replay_of_missing_index(repository): |
nothing calls this directly
no test coverage detected