MCPcopy Create free account
hub / github.com/wal-e/wal-e / test_atomic_download

Function test_atomic_download

tests/test_prefetch.py:35–54  ·  view source on GitHub ↗
(pd, seg, tmpdir)

Source from the content-addressed store, hash-verified

33
34
35def test_atomic_download(pd, seg, tmpdir):
36 assert not pd.is_running(seg)
37
38 pd.create(seg)
39 assert pd.is_running(seg)
40
41 with pd.download(seg) as ad:
42 s = b'hello'
43 ad.tf.write(s)
44 ad.tf.flush()
45 assert pd.running_size(seg) == len(s)
46
47 assert pd.contains(seg)
48 assert not pd.is_running(seg)
49
50 promote_target = tmpdir.join('another-spot')
51 pd.promote(seg, str(promote_target))
52
53 pd.clear()
54 assert not pd.contains(seg)
55
56
57def test_atomic_download_failure(pd, seg):

Callers

nothing calls this directly

Calls 10

is_runningMethod · 0.80
downloadMethod · 0.80
writeMethod · 0.80
flushMethod · 0.80
running_sizeMethod · 0.80
containsMethod · 0.80
promoteMethod · 0.80
clearMethod · 0.80
createMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected