feat: sync latest ARR implementation
This commit is contained in:
@@ -164,18 +164,36 @@ class AliyunOssV2Tests(unittest.TestCase):
|
||||
exchange.object_key("handle_001"),
|
||||
"private-agent-results/handle_001",
|
||||
)
|
||||
self.client(FakeOssClient()).assert_immutable_writes_supported()
|
||||
self.client(
|
||||
FakeOssClient(acl="public-read", block_public_access=False)
|
||||
).assert_immutable_writes_supported()
|
||||
for acl in ("private", "public-read"):
|
||||
self.client(FakeOssClient(acl=acl)).assert_immutable_writes_supported()
|
||||
for status in ("Enabled", "Suspended"):
|
||||
with self.subTest(status=status), self.assertRaises(CloudClientError) as caught:
|
||||
self.client(FakeOssClient(version_status=status)).assert_immutable_writes_supported()
|
||||
self.client(
|
||||
FakeOssClient(
|
||||
version_status=status,
|
||||
acl="public-read",
|
||||
block_public_access=False,
|
||||
)
|
||||
).assert_immutable_writes_supported()
|
||||
self.assertEqual(caught.exception.kind, "versioning_incompatible")
|
||||
incompatible = (
|
||||
(FakeOssClient(acl="public-read-write"), "public_access_incompatible"),
|
||||
(FakeOssClient(encrypted=False), "encryption_incompatible"),
|
||||
(FakeOssClient(location="oss-cn-beijing"), "region_mismatch"),
|
||||
(
|
||||
FakeOssClient(
|
||||
encrypted=False,
|
||||
acl="public-read",
|
||||
block_public_access=False,
|
||||
),
|
||||
"encryption_incompatible",
|
||||
),
|
||||
(
|
||||
FakeOssClient(
|
||||
location="oss-cn-beijing",
|
||||
acl="public-read",
|
||||
block_public_access=False,
|
||||
),
|
||||
"region_mismatch",
|
||||
),
|
||||
)
|
||||
for fake, expected in incompatible:
|
||||
with self.subTest(expected=expected), self.assertRaises(CloudClientError) as caught:
|
||||
@@ -219,7 +237,7 @@ class AliyunOssV2Tests(unittest.TestCase):
|
||||
self.assertTrue(created["closed"])
|
||||
|
||||
def test_managed_store_uses_conditional_staged_commit_and_rechecks_bytes(self) -> None:
|
||||
fake = FakeOssClient()
|
||||
fake = FakeOssClient(acl="public-read", block_public_access=False)
|
||||
client = self.client(fake)
|
||||
store = ManagedObjectStore(
|
||||
CloudObjectBackend(client),
|
||||
@@ -238,7 +256,10 @@ class AliyunOssV2Tests(unittest.TestCase):
|
||||
self.assertEqual(committed.state, "committed")
|
||||
self.assertIn("/committed/source_xml/", committed.object_key)
|
||||
self.assertFalse(any("/staged/" in key for key in fake.objects))
|
||||
self.assertTrue(all(item["acl"] == "private" for item in fake.objects.values()))
|
||||
self.assertEqual(
|
||||
fake.objects[committed.object_key]["acl"],
|
||||
"private",
|
||||
)
|
||||
with client.stream_object(committed.object_key) as reader:
|
||||
first = reader.read(3)
|
||||
self.assertEqual(first + reader.read(), source.read_bytes())
|
||||
@@ -274,6 +295,7 @@ class AliyunOssV2Tests(unittest.TestCase):
|
||||
metadata=metadata,
|
||||
)
|
||||
self.assertEqual(first.object_key, second.object_key)
|
||||
self.assertEqual(fake.objects[first.object_key]["acl"], "private")
|
||||
destination = root / "materialized.json"
|
||||
PrefixRemoteFilePort(client, config).materialize(
|
||||
"arrout_test-001", destination, 1024
|
||||
|
||||
Reference in New Issue
Block a user