fix(recover): return the file content, not a path on this host (#10)
This commit was merged in pull request #10.
This commit is contained in:
@@ -256,3 +256,44 @@ def test_flr_gate_refuses_remote_recovery_site_and_names_it():
|
||||
# must tell the operator where the operation actually lives
|
||||
assert out["recovery_site"] == "aws-zca"
|
||||
assert "aws-zca" in out["message"]
|
||||
|
||||
|
||||
def test_encode_recovered_text_and_binary():
|
||||
from zerto_rewind_mcp.server import _encode_recovered
|
||||
|
||||
text = _encode_recovered(b"listen: 0.0.0.0:8443\n")
|
||||
assert text["encoding"] == "text"
|
||||
assert text["content"] == "listen: 0.0.0.0:8443\n"
|
||||
|
||||
binary = _encode_recovered(b"\x89PNG\r\n\x1a\n\xff\xfe")
|
||||
assert binary["encoding"] == "base64"
|
||||
import base64 as b64
|
||||
|
||||
assert b64.b64decode(binary["content"]) == b"\x89PNG\r\n\x1a\n\xff\xfe"
|
||||
|
||||
|
||||
def test_recover_file_takes_no_caller_destination():
|
||||
"""The caller must not choose where bytes land, nor where the ZVM mounts.
|
||||
|
||||
dest_dir used to be a tool parameter whose value was also passed to the
|
||||
appliance as initialDownloadPath.
|
||||
"""
|
||||
import inspect
|
||||
|
||||
from zerto_rewind_mcp.server import zerto_recover_file
|
||||
|
||||
params = set(inspect.signature(zerto_recover_file).parameters)
|
||||
assert "dest_dir" not in params
|
||||
assert params == {
|
||||
"vpg_identifier",
|
||||
"vm_identifier",
|
||||
"checkpoint_identifier",
|
||||
"guest_path",
|
||||
"confirmed",
|
||||
}
|
||||
|
||||
|
||||
def test_recover_byte_cap_is_configurable_and_has_a_default():
|
||||
from zerto_rewind_mcp.server import MAX_RECOVER_BYTES
|
||||
|
||||
assert MAX_RECOVER_BYTES == 1_048_576
|
||||
|
||||
Reference in New Issue
Block a user