Support durable host-to-isolated workspace migration
This commit is contained in:
parent
db9a561d0c
commit
0dda65fc2e
3 changed files with 1176 additions and 32 deletions
|
|
@ -6,6 +6,16 @@
|
|||
"isolated"
|
||||
],
|
||||
"transition_contracts": [
|
||||
{
|
||||
"id": "qualified-host-to-isolated-rename",
|
||||
"operations": [
|
||||
"rename",
|
||||
"rename-noreplace"
|
||||
],
|
||||
"result": "success",
|
||||
"mutation": "durable-host-to-isolated-migration",
|
||||
"copy": "host-to-isolated-only"
|
||||
},
|
||||
{
|
||||
"id": "cross-route-rename",
|
||||
"operations": [
|
||||
|
|
@ -96,13 +106,13 @@
|
|||
"operation": "rename",
|
||||
"host": "supported",
|
||||
"isolated": "supported",
|
||||
"cross_route": "EXDEV"
|
||||
"cross_route": "qualified-host-to-isolated-or-EXDEV"
|
||||
},
|
||||
{
|
||||
"operation": "rename-noreplace",
|
||||
"host": "supported",
|
||||
"isolated": "supported",
|
||||
"cross_route": "EXDEV"
|
||||
"cross_route": "qualified-host-to-isolated-or-EXDEV"
|
||||
},
|
||||
{
|
||||
"operation": "rename-exchange",
|
||||
|
|
|
|||
|
|
@ -74,6 +74,14 @@
|
|||
"actions": ["host-publish-ignore", "sandbox-open-after-publication"],
|
||||
"expect": ["single-classification-epoch", "host-object-hidden", "no-copy"]
|
||||
},
|
||||
{
|
||||
"id": "cargo-target-host-to-isolated-rename",
|
||||
"tags": ["rename", "cross-policy-rename", "no-copy-back"],
|
||||
"path_hex": "746172676574",
|
||||
"setup": ["router-created-host-directory", "router-created-cachedir-tag", "ignored-destination"],
|
||||
"actions": ["sandbox-rename"],
|
||||
"expect": ["success", "qualified-isolated-destination", "host-source-absent", "no-isolated-to-host-copy"]
|
||||
},
|
||||
{
|
||||
"id": "cross-route-file-rename",
|
||||
"tags": ["rename", "cross-policy-rename", "no-silent-loss"],
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class IgnoredWorkspaceContractTests(unittest.TestCase):
|
|||
self.assertEqual(contract["mechanism"], "rootless-host-fuse-router")
|
||||
self.assertEqual(contract["route_classes"], ["host", "isolated"])
|
||||
|
||||
def test_cross_route_namespace_operations_refuse_before_mutation(self) -> None:
|
||||
def test_cross_route_namespace_operations_are_directionally_bounded(self) -> None:
|
||||
transitions = {
|
||||
transition["id"]: transition
|
||||
for transition in load("contract.json")["transition_contracts"]
|
||||
|
|
@ -166,6 +166,16 @@ class IgnoredWorkspaceContractTests(unittest.TestCase):
|
|||
with self.subTest(transition_id=transition_id):
|
||||
self.assertEqual(transitions[transition_id]["mutation"], "none")
|
||||
self.assertEqual(transitions["cross-route-rename"]["result"], "EXDEV")
|
||||
self.assertEqual(
|
||||
transitions["qualified-host-to-isolated-rename"],
|
||||
{
|
||||
"id": "qualified-host-to-isolated-rename",
|
||||
"operations": ["rename", "rename-noreplace"],
|
||||
"result": "success",
|
||||
"mutation": "durable-host-to-isolated-migration",
|
||||
"copy": "host-to-isolated-only",
|
||||
},
|
||||
)
|
||||
self.assertEqual(transitions["cross-route-hard-link"]["result"], "EXDEV")
|
||||
self.assertEqual(transitions["rename-whiteout"]["result"], "EOPNOTSUPP")
|
||||
|
||||
|
|
@ -176,7 +186,7 @@ class IgnoredWorkspaceContractTests(unittest.TestCase):
|
|||
for transition in transitions
|
||||
if "copy" in transition and transition["copy"] != "none"
|
||||
]
|
||||
self.assertEqual(copying, [])
|
||||
self.assertEqual(copying, ["qualified-host-to-isolated-rename"])
|
||||
handle_transitions = {
|
||||
transition["id"]: transition["open_handles"]
|
||||
for transition in transitions
|
||||
|
|
@ -214,6 +224,13 @@ class IgnoredWorkspaceContractTests(unittest.TestCase):
|
|||
self.assertEqual(
|
||||
transitions,
|
||||
[
|
||||
{
|
||||
"id": "qualified-host-to-isolated-rename",
|
||||
"operations": ["rename", "rename-noreplace"],
|
||||
"result": "success",
|
||||
"mutation": "durable-host-to-isolated-migration",
|
||||
"copy": "host-to-isolated-only",
|
||||
},
|
||||
{
|
||||
"id": "cross-route-rename",
|
||||
"operations": ["rename", "rename-noreplace", "rename-exchange"],
|
||||
|
|
@ -310,7 +327,10 @@ class IgnoredWorkspaceContractTests(unittest.TestCase):
|
|||
"character-block-device-create",
|
||||
}
|
||||
self.assertTrue(required.issubset(operations))
|
||||
self.assertEqual(operations["rename"]["cross_route"], "EXDEV")
|
||||
self.assertEqual(
|
||||
operations["rename"]["cross_route"],
|
||||
"qualified-host-to-isolated-or-EXDEV",
|
||||
)
|
||||
self.assertEqual(operations["hard-link"]["cross_route"], "EXDEV")
|
||||
self.assertEqual(operations["copy-file-range"]["cross_route"], "EXDEV")
|
||||
self.assertEqual(operations["character-block-device-create"]["host"], "EPERM")
|
||||
|
|
|
|||
Loading…
Reference in a new issue