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

Function test_multi_pipeline_fail

tests/test_wal_transfer.py:158–183  ·  view source on GitHub ↗

Model a failure of the pipelined segments under concurrency.

()

Source from the content-addressed store, hash-verified

156
157
158def test_multi_pipeline_fail():
159 """Model a failure of the pipelined segments under concurrency."""
160 group = worker.WalTransferGroup(FakeWalUploader())
161 segments = list(prepare_multi_upload_segments())
162
163 exp = Explosion('fail')
164 fail_idx = 2
165 segments[fail_idx]._upload_explosive = exp
166
167 for seg in segments:
168 group.start(seg)
169
170 with pytest.raises(Explosion) as e:
171 group.join()
172
173 assert e.value is exp
174
175 for i, seg in enumerate(segments):
176 if i == fail_idx:
177 assert failed(seg)
178 else:
179 # Given race conditions in conjunction with exceptions --
180 # which will abort waiting for other greenlets to finish
181 # -- one can't know very much about the final state of
182 # segment.
183 assert indeterminate(seg)
184
185
186def test_finally_execution():

Callers

nothing calls this directly

Calls 7

startMethod · 0.95
joinMethod · 0.95
FakeWalUploaderClass · 0.85
failedFunction · 0.85
indeterminateFunction · 0.85
ExplosionClass · 0.70

Tested by

no test coverage detected