1+ from dstack_sdk .dstack_client import TcbInfo
2+ from dstack_sdk .dstack_client import InfoResponse
13import hashlib
24import pytest
35
@@ -25,6 +27,26 @@ def test_sync_client_get_tls_key():
2527 assert len (result .key ) > 0
2628 assert len (result .certificate_chain ) > 0
2729
30+ def test_sync_client_get_info ():
31+ client = DstackClient ()
32+ result = client .info ()
33+ check_info_response (result )
34+
35+ def check_info_response (result : InfoResponse ):
36+ assert isinstance (result , InfoResponse )
37+ assert isinstance (result .app_id , str )
38+ assert isinstance (result .instance_id , str )
39+ assert isinstance (result .tcb_info , TcbInfo )
40+ assert len (result .tcb_info .mrtd ) == 96
41+ assert len (result .tcb_info .rtmr0 ) == 96
42+ assert len (result .tcb_info .rtmr1 ) == 96
43+ assert len (result .tcb_info .rtmr2 ) == 96
44+ assert len (result .tcb_info .rtmr3 ) == 96
45+ assert len (result .tcb_info .compose_hash ) == 64
46+ assert len (result .tcb_info .device_id ) == 64
47+ assert len (result .tcb_info .app_compose ) > 0
48+ assert len (result .tcb_info .event_log ) > 0
49+
2850@pytest .mark .asyncio
2951async def test_async_client_get_key ():
3052 client = AsyncDstackClient ()
@@ -46,6 +68,12 @@ async def test_async_client_get_tls_key():
4668 assert result .key .startswith ('-----BEGIN PRIVATE KEY-----' )
4769 assert len (result .certificate_chain ) > 0
4870
71+ @pytest .mark .asyncio
72+ async def test_async_client_get_info ():
73+ client = AsyncDstackClient ()
74+ result = await client .info ()
75+ check_info_response (result )
76+
4977@pytest .mark .asyncio
5078async def test_tls_key_uniqueness ():
5179 """Test that TLS keys are unique across multiple calls."""
0 commit comments