test(secrets): assert Vault rotation request paths

This commit is contained in:
Yujong Lee 2026-09-22 22:08:35 -07:00
parent 2b19b62f03
commit e6980ed358
2 changed files with 7 additions and 1 deletions

View file

@ -265,7 +265,7 @@ Rotation preserves the documented fresh-read safeguard. Python's base rotation c
Public Vault writes, deletes and rotation now use catalog selection. Their Python signatures and coroutine entrypoints stay unchanged. Native operations use the Vault SDK request types and authenticated client while retaining the complete response bytes for Python JSON conversion. This preserves additional response fields, key order and arbitrary-size integers. Python-compatible writes make one provider attempt; the existing native API keeps its CAS recovery behavior
`test_public_vault_writes_preserve_complete_responses_and_request_fields` checks the response envelope, nested operation settings, payload and ignored tags. `test_public_vault_mutation_http_errors_match_python_without_retry` compares write/delete error dictionaries, including namespace URLs and exact request counts. Rotation tests compare current-secret failures, write failures, failed verification, mismatched values, malformed verification shapes, same-name updates and best-effort old-alias deletion. A successful HTTP response containing `status: error` stops rotation and returns the original response. Verification fields remain raw JSON until Python error conversion, preserving large integers, nested values and the distinction between integer and floating-point type errors. Unsupported extension selection is checked separately for write, delete and rotate
`test_public_vault_writes_preserve_complete_responses_and_request_fields` checks the response envelope, nested operation settings, payload and ignored tags. `test_public_vault_mutation_http_errors_match_python_without_retry` compares write/delete error dictionaries, including namespace URLs and exact request counts. Rotation tests compare current-secret failures, ordered request paths, write failures, failed verification, mismatched values, malformed verification shapes, same-name updates and best-effort old-alias deletion. A successful HTTP response containing `status: error` stops rotation and returns the original response. Verification fields remain raw JSON until Python error conversion, preserving large integers, nested values and the distinction between integer and floating-point type errors. Unsupported extension selection is checked separately for write, delete and rotate
`test_public_vault_mutation_timeouts_match_python` compares operation-specific timeout messages. The elapsed duration in a POST error is measured independently, so the test checks its structure and lower bound rather than requiring two independent requests to have identical elapsed time. Phase-specific connect/read/write/pool deadlines and cached Python transport configuration still need broader parity checks

View file

@ -1332,6 +1332,12 @@ async def test_public_vault_rotation_failure_messages_and_request_counts_match_p
actual: Final = await native_manager.async_rotate_secret("OLD", "NEW", "value")
assert actual == reference
assert actual["status"] == "error"
expected_paths: Final = (
("/v1/secret/data/OLD",)
+ (("/v1/secret/data/NEW",) if stage != "current" else ())
+ (("/v1/secret/data/NEW",) if stage == "verify" else ())
)
assert tuple(urlsplit(request.path).path for request in server.requests) == expected_paths * 2
@pytest.mark.parametrize("value", (None, "different", True, 42, 2**100, [1, "two"], [2**100], {"nested": 2**100}))