test(openspec): map cloud integration scenarios
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user