test(openspec): map cloud integration scenarios

This commit is contained in:
2026-07-13 08:21:44 +08:00
parent ffc3df6c5b
commit 7b717a05a9
8 changed files with 200 additions and 6 deletions
+31
View File
@@ -123,6 +123,37 @@ def test_repository_crud_contract(database_url: str) -> None:
database.close()
def test_repository_can_atomically_transfer_explicit_device_takeover(
database_url: str,
) -> None:
database = CloudDatabase(database_url)
repository = database.repository
old_host_id = _unique_id("old-host")
new_host_id = _unique_id("new-host")
device_id = _unique_id("shared-device")
try:
repository.replace_host_devices(
old_host_id,
[_device(device_id, old_host_id)],
)
repository.replace_host_devices(
new_host_id,
[_device(device_id, new_host_id)],
allow_device_takeover=True,
)
matching = [
device
for device in repository.list_devices()
if device.device_id == device_id
]
assert len(matching) == 1
assert matching[0].host_id == new_host_id
finally:
database.close()
def test_failed_snapshot_transaction_rolls_back(database_url: str) -> None:
database = CloudDatabase(database_url)
repository = database.repository