Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix right type on create_session #159

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/aleph/sdk/client/vm_confidential_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def get_certificates(self) -> Tuple[Optional[int], str]:
return None, str(e)

async def create_session(
self, vm_id: ItemHash, certificate_path: Path, policy: int
self, certificate_prefix: str, platform_certificate_path: Path, policy: int
) -> Path:
"""
Create new confidential session
Expand All @@ -66,8 +66,8 @@ async def create_session(
args = [
"session",
"--name",
str(vm_id),
str(certificate_path),
certificate_prefix,
str(platform_certificate_path),
str(policy),
]
try:
Expand Down
14 changes: 9 additions & 5 deletions tests/unit/test_vm_confidential_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ async def test_confidential_inject_secret_instance():
@pytest.mark.asyncio
async def test_create_session_command():
account = ETHAccount(private_key=b"0x" + b"1" * 30)
vm_id = ItemHash("cafecafecafecafecafecafecafecafecafecafecafecafecafecafecafecafe")
node_url = "http://localhost"
sevctl_path = Path("/usr/bin/sevctl")
certificates_path = Path("/")
certificate_prefix = (
"cafecafecafecafecafecafecafecafecafecafecafecafecafecafecafecafe/vm"
)
platform_certificate_path = Path("/")
policy = 1

with mock.patch(
Expand All @@ -202,14 +204,16 @@ async def test_create_session_command():
node_url=node_url,
session=aiohttp.ClientSession(),
)
_ = await vm_client.create_session(vm_id, certificates_path, policy)
_ = await vm_client.create_session(
certificate_prefix, platform_certificate_path, policy
)
export_mock.assert_called_once_with(
[
str(sevctl_path),
"session",
"--name",
str(vm_id),
str(certificates_path),
certificate_prefix,
str(platform_certificate_path),
str(policy),
],
check=True,
Expand Down
Loading