From 959027194daa16c8e18f22a3df95e20eceffabcb Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 20 Nov 2026 00:03:53 -0500 Subject: [PATCH] test(moves): drop preflight e2e cases the in-process preflight covers Removed from e2e/move_test.py (11 -> 8 tests; 5.7 s in the durations file, one of them exclusive): - a compatible target offered without writing on either side, an old staged import there left alone: move_preflight_test a_compatible_target_is_offered_and_nothing_is_written. - a column the target lacks refusing the move as older: a_column_the_target_lacks_refuses_the_move. - an unreachable target unavailable with its transport words: an_unreachable_target_is_unavailable_with_its_reason. The ssh words themselves come from albedo_ssh.py, which its harness tests cover. The protocol, runtime-probe and profile cases stay: they drive a failing move, the host probe, or the target's own profile resolution. --- e2e/move_test.py | 67 ------------------------------------------------ 1 file changed, 67 deletions(-) diff --git a/e2e/move_test.py b/e2e/move_test.py index 6a0c6c48c..861b1f15b 100644 --- a/e2e/move_test.py +++ b/e2e/move_test.py @@ -18,7 +18,6 @@ import shutil import sqlite3 import tempfile import threading -import time import unittest import urllib.error import urllib.parse @@ -39,7 +38,6 @@ from harness import ( Albedo, Provider, ROOT, - exclusive, exclusive_class, operation_id, peer_daemon, @@ -303,61 +301,6 @@ class MoveTests(unittest.TestCase): # The target's token stays on the target: never in an ssh command line. self.assertNotIn(self.target.connection["token"], self.ssh_log.read_text()) - STALE = "0195f3a2-0000-7000-8000-00000000beef" - - def seed_expired_import(self): - """An import the target staged long ago, which its staging would - expire: its row and a segment file, which a preflight must leave.""" - staged = self.target.home / "transfers" / self.STALE / "import" - staged.mkdir(parents=True) - (staged / "0.seg").write_bytes(b"left from an old move") - with closing(sqlite3.connect(self.target.home / "albedo.sqlite")) as db: - db.execute( - "INSERT INTO transfers(id,role,intent,state,manifest,bytes," - "created_at,updated_at,workspace) " - "VALUES(?,'import','old','staging','{}',21,0,0,'/old')", - (self.STALE,), - ) - db.commit() - - def assert_target_untouched(self): - """The seeded import is still the target's only transfer state.""" - target_db = self.target.home / "albedo.sqlite" - with closing(sqlite3.connect(f"file:{target_db}?mode=ro", uri=True)) as db: - rows = db.execute("SELECT id,state FROM transfers").fetchall() - self.assertEqual(rows, [(self.STALE, "staging")]) - self.assertEqual( - sorted(p.name for p in (self.target.home / "transfers").iterdir()), - [self.STALE], - ) - staged = self.target.home / "transfers" / self.STALE / "import" - self.assertEqual([p.name for p in staged.iterdir()], ["0.seg"]) - - def test_a_compatible_target_is_available_and_preflight_writes_nothing(self): - self.seed_expired_import() - session = self.session() - - found = self.preflight(session, f"vassago:{self.destination}") - self.assertTrue(found["available"], found) - self.assertIsNone(found.get("code"), found) - self.assert_target_untouched() - - # The source's schema changes, so the daemon is this test's alone. - @exclusive - def test_a_target_lacking_a_column_is_refused_in_preflight_writing_nothing(self): - self.seed_expired_import() - session = self.session() - # A column the target's sessions table lacks, as a newer build adds. - with closing(sqlite3.connect(self.app.home / "albedo.sqlite")) as db: - db.execute("ALTER TABLE sessions ADD COLUMN check_probe TEXT") - db.commit() - - found = self.preflight(session, f"vassago:{self.destination}") - self.assertFalse(found["available"], found) - self.assertEqual(found["code"], "transfer_target_older", found) - self.assertIn("core/sessions here lacks check_probe", found["reason"]) - self.assert_target_untouched() - def test_a_target_on_another_protocol_is_refused_before_export(self): OldDaemon.seen = [] server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), OldDaemon) @@ -391,16 +334,6 @@ class MoveTests(unittest.TestCase): with self.app.api(f"/sessions/{session}?tail=0") as response: self.assertIsNone(json.load(response)["moved"]) - def test_an_unreachable_target_is_unavailable_with_ssh_words(self): - session = self.session() - began = time.monotonic() - found = self.preflight(session, "gone:/srv/project") - self.assertLess(time.monotonic() - began, 10) - self.assertFalse(found["available"]) - self.assertIn("Connection refused", found["reason"]) - self.assertEqual(found["target_daemon"]["host"], "gone") - self.assertIsNone(found["target_daemon"]["protocol"]) - def test_a_host_without_a_supported_runtime_fails_the_move_saying_so(self): session = self.session() transfer = operation_id() -- knotmirror 0.0.1