| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
import os |
| 11 |
|
| 12 |
from mutatefns import TARGET, assert_no_protocol_abort, run_mutating_transfer |
| 13 |
from rsyncfns import test_fail |
| 14 |
|
| 15 |
|
| 16 |
def setup(src): |
| 17 |
with open(src / TARGET, 'wb') as fh: |
| 18 |
fh.write(os.urandom(256 * 1024)) |
| 19 |
|
| 20 |
|
| 21 |
def mutate(src): |
| 22 |
os.unlink(src / TARGET) |
| 23 |
|
| 24 |
|
| 25 |
proc, src, dst = run_mutating_transfer(setup, mutate) |
| 26 |
assert_no_protocol_abort(proc) |
| 27 |
|
| 28 |
if (src / TARGET).exists(): |
| 29 |
test_fail("test setup: source file did not vanish") |
| 30 |
|
| 31 |
|
| 32 |
if not (dst / 'aaa_pacer').is_file(): |
| 33 |
test_fail("the pacer file was not transferred after the vanish") |
| 34 |
|
| 35 |
print(f"change-vanish: source file removed mid-transfer; rsync exit " |
| 36 |
f"{proc.returncode} (0/24 ok), no protocol abort, later files intact") |