mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-03 16:41:26 +01:00
test(acceptance): remove the local-only symlink the mirror-copy case leaves
"move never loses a mirror copy Drive lacks" puts a symlink in a mirror folder to prove a move does not lose what sync never uploads, and left it there. The next mode pairing switches that folder to on-demand, which the daemon refuses because the link exists only on this computer, so the account run stopped after pairing 2 of 4. The case now removes the link wherever the move left it, whether it passes or fails.
This commit is contained in:
1 parent
69d4feaa07
commit
c2bf87596f
1 file changed
+15
@@ -4388,6 +4388,21 @@ def test_move_refuses_a_mirror_copy_drive_lacks(mc: MoveContext) -> None:
|
|||||||
# Sync skips symlinks, so Drive never gets this one: removing the local
|
# Sync skips symlinks, so Drive never gets this one: removing the local
|
||||||
# copy after a move would lose it.
|
# copy after a move would lose it.
|
||||||
os.symlink("data.txt", source.root / name / "link")
|
os.symlink("data.txt", source.root / name / "link")
|
||||||
|
try:
|
||||||
|
_move_keeps_what_drive_lacks(mc, source, dest, name, files)
|
||||||
|
finally:
|
||||||
|
# The link stays local-only wherever it ended up, and a mirror folder
|
||||||
|
# holding one refuses the switch to on-demand that the next mode
|
||||||
|
# pairing makes.
|
||||||
|
for location in (source, dest):
|
||||||
|
link = location.root / name / "link"
|
||||||
|
if os.path.lexists(link):
|
||||||
|
os.unlink(link)
|
||||||
|
|
||||||
|
|
||||||
|
def _move_keeps_what_drive_lacks(
|
||||||
|
mc: MoveContext, source: Location, dest: Location, name: str, files: dict[Path, bytes]
|
||||||
|
) -> None:
|
||||||
source.settle()
|
source.settle()
|
||||||
if dest.mode == "mirror" and os.stat(source.folder).st_dev == os.stat(dest.folder).st_dev:
|
if dest.mode == "mirror" and os.stat(source.folder).st_dev == os.stat(dest.folder).st_dev:
|
||||||
# Between two mirrors on one filesystem the local copy is renamed
|
# Between two mirrors on one filesystem the local copy is renamed
|
||||||
|
|||||||
Reference in new issue
Block a user