Skip to main content
Glama
test_vm_info_cache.cpython-313-pytest-8.3.5.pyc17 kB
� Ah� ��^�SSKrSSKJs Jr SSKrSSKrSSKJ r Sr Sr Sr Sr SrSrg) �N)� VMInfoCachec��[SSS9nURnSo!U:Ho3(d�[R"SU4SX45S[R "5;d[R "U5(a[R"U5OS[R"U5[R"U5S.-nSS U0-n[[R"U55eS =n=p2URnSo!U:Ho3(d�[R"SU4S X45S[R "5;d[R "U5(a[R"U5OS[R"U5[R"U5S.-nSS U0-n[[R"U55eS =n=p2URn[U5nS orU:Ho�(Gd"[R"SU4S X'45S[R "5;d[R "[5(a[R"[5OSS[R "5;d[R "U5(a[R"U5OS[R"U5[R"U5[R"U5S.-n SSU 0-n [[R"U 55eS =n=n=p�URn[U5nS orU:Ho�(Gd"[R"SU4SX'45S[R "5;d[R "[5(a[R"[5OSS[R "5;d[R "U5(a[R"U5OS[R"U5[R"U5[R"U5S.-n SSU 0-n [[R"U 55eS =n=n=p�g )z,Test the initialization of the VM info cache� �)�max_size�ttl��==)z0%(py2)s {%(py2)s = %(py0)s.max_size } == %(py5)s�cache)�py0�py2�py5�assert %(py7)s�py7N)z+%(py2)s {%(py2)s = %(py0)s.ttl } == %(py5)sr)zK%(py5)s {%(py5)s = %(py0)s(%(py3)s {%(py3)s = %(py1)s.cache }) } == %(py8)s�len)r �py1�py3r�py8�assert %(py10)s�py10)zP%(py5)s {%(py5)s = %(py0)s(%(py3)s {%(py3)s = %(py1)s.timestamps }) } == %(py8)s)rr� @pytest_ar�_call_reprcompare� @py_builtins�locals�_should_repr_global_name� _saferepr�AssertionError�_format_explanationrr r� timestamps) r � @py_assert1� @py_assert4� @py_assert3� @py_format6� @py_format8� @py_assert2� @py_assert7� @py_assert6� @py_format9� @py_format11s �8/home/steve/projects/kvm-mcp/tests/test_vm_info_cache.py�!test_vm_info_cache_initializationr+s?�� ��� ,�E� �>�>��R��R� �����>�������5�����5����>����R�������� �9�9�����?�����9�������5�����5����9�������������{�{� �3�{� � �q� �q� � � � � � � � � � � � �3� � � � �3� � � � � � �u� � � � �u� � � �{� � � � � � � �q� � � � � � � ����%�3�� �%�A�%�A� %�%�%�%�%� �%�%�%�%�%�%�3�%�%�%�%�3�%�%�%�%�%�%�u�%�%�%�%�u�%�%�%��%�%�%� �%�%�%�A�%�%�%�%�%�%�%�c���[5nSSS.nURSU5 URnSo2"U5oDU:HoU(Gd[R"SU4SXA45S[ R "5;d[R"U5(a[R"U5OS[R"U5[R"U5[R"U5S[ R "5;d[R"U5(a[R"U5OSS.-nS S U0-n[[R"U55eS =n=n=pEURnS o2"U5nS o�ULoU(d�[R"S U4SXH45S[ R "5;d[R"U5(a[R"U5OS[R"U5[R"U5[R"U5[R"U5S.-n SSU 0-n [[R"U 55eS =n=n=n=pXg )z/Test setting and getting VM info from the cache�test-vm�running��name�stater �zI%(py6)s {%(py6)s = %(py2)s {%(py2)s = %(py0)s.get }(%(py4)s) } == %(py8)sr �vm_info�r r �py4�py6rrrNz non-existent��is�zI%(py6)s {%(py6)s = %(py2)s {%(py2)s = %(py0)s.get }(%(py4)s) } is %(py9)s�r r r6r7�py9�assert %(py11)s�py11� r�set�getrrrrrrrr� r r4r r"� @py_assert5r&r(r)� @py_assert8� @py_format10� @py_format12s r*�test_vm_info_cache_set_getrG sf�� �M�E� �9�5�G� �I�I�i��!� �9�9�*�Y�*�9�Y� �*�7� *�*�*�*�*� �*�*�*�*�*�*�5�*�*�*�*�5�*�*�*�9�*�*�*�Y�*�*�*� �*�*�*�*�*�*�7�*�*�*�*�7�*�*�*�*�*�*�*� �9�9�,�^�,�9�^� $�,��,�� ,�,�,�,�,� $�,�,�,�,�,�,�5�,�,�,�,�5�,�,�,�9�,�,�,�^�,�,�,� $�,�,�,��,�,�,�,�,�,�,�,r,c� �[SS9nSSS.nURSU5 URnSo2"U5oDU:HoU(Gd[R"SU4SXA45S[ R "5;d[R"U5(a[R"U5OS[R"U5[R"U5[R"U5S [ R "5;d[R"U5(a[R"U5OS S .-nS S U0-n[[R"U55eS =n=n=pE[R"S5 URnSo2"U5nS o�ULoU(d�[R"SU4SXH45S[ R "5;d[R"U5(a[R"U5OS[R"U5[R"U5[R"U5[R"U5S.-n SSU 0-n [[R"U 55eS =n=n=n=pXg )zTest cache entry expirationg�������?)rr.r/r0r r3r r4r5rrNg�������?r8r:r;r=r>) rr@rArrrrrrrr�time�sleeprBs r*�test_vm_info_cache_expirationrKsr�� �C� �E� �9�5�G� �I�I�i��!� �9�9�*�Y�*�9�Y� �*�7� *�*�*�*�*� �*�*�*�*�*�*�5�*�*�*�*�5�*�*�*�9�*�*�*�Y�*�*�*� �*�*�*�*�*�*�7�*�*�*�*�7�*�*�*�*�*�*�*� �J�J�s�O� �9�9�'�Y�'�9�Y� �'�4�'�4� '�'�'�'�'� �'�'�'�'�'�'�5�'�'�'�'�5�'�'�'�9�'�'�'�Y�'�'�'� �'�'�'�4�'�'�'�'�'�'�'�'r,c���[SS9nURSSS05 URSSS05 URSSS05 URnSo!"U5nSoCULoU(d�[R"SU4S X445S [ R "5;d[R"U5(a[R"U5OS [R"U5[R"U5[R"U5[R"U5S .-nS S U0-n[[R"U55eS=n=n=n=pTURnSo!"U5nSoCULoU(d�[R"SU4SX445S [ R "5;d[R"U5(a[R"U5OS [R"U5[R"U5[R"U5[R"U5S .-nS S U0-n[[R"U55eS=n=n=n=pTURnSo!"U5nSoCULoU(d�[R"SU4SX445S [ R "5;d[R"U5(a[R"U5OS [R"U5[R"U5[R"U5[R"U5S .-nS S U0-n[[R"U55eS=n=n=n=pTg)zTest cache size limit�)r�vm1r1�vm2�vm3Nr8r:r r;r=r>��is not�zM%(py6)s {%(py6)s = %(py2)s {%(py2)s = %(py0)s.get }(%(py4)s) } is not %(py9)sr?�r r r"rCrDr&rErFs r*�test_vm_info_cache_max_sizerU%s �� �� #�E� �I�I�e�f�e�_�%� �I�I�e�f�e�_�%� �I�I�e�f�e�_�%� �9�9�#�U�#�9�U� �#�t�#�t� #�#�#�#�#� �#�#�#�#�#�#�5�#�#�#�#�5�#�#�#�9�#�#�#�U�#�#�#� �#�#�#�t�#�#�#�#�#�#�#� �9�9�'�U�'�9�U� �'�4�'�4� '�'�'�'�'� �'�'�'�'�'�'�5�'�'�'�'�5�'�'�'�9�'�'�'�U�'�'�'� �'�'�'�4�'�'�'�'�'�'�'� �9�9�'�U�'�9�U� �'�4�'�4� '�'�'�'�'� �'�'�'�'�'�'�5�'�'�'�'�5�'�'�'�9�'�'�'�U�'�'�'� �'�'�'�4�'�'�'�'�'�'�'�'r,c� �[5nURSSS05 URSSS05 URS5 URnSo!"U5nSoCULoU(d�[R "SU4SX445S[ R"5;d[R"U5(a[R"U5OS[R"U5[R"U5[R"U5[R"U5S.-nS S U0-n[[R"U55eS=n=n=n=pTURnSo!"U5nSoCULoU(d�[R "S U4S X445S[ R"5;d[R"U5(a[R"U5OS[R"U5[R"U5[R"U5[R"U5S.-nS S U0-n[[R"U55eS=n=n=n=pTUR5 URnSo!"U5nSoCULoU(d�[R "SU4SX445S[ R"5;d[R"U5(a[R"U5OS[R"U5[R"U5[R"U5[R"U5S.-nS S U0-n[[R"U55eS=n=n=n=pTURnSo!"U5nSoCULoU(d�[R "SU4SX445S[ R"5;d[R"U5(a[R"U5OS[R"U5[R"U5[R"U5[R"U5S.-nS S U0-n[[R"U55eS=n=n=n=pTg) zTest cache invalidationrNr1rONr8r:r r;r=r>rQrS) rr@� invalidaterArrrrrrrrrTs r*�test_vm_info_cache_invalidaterX3s��� �M�E� �I�I�e�f�e�_�%� �I�I�e�f�e�_�%� ���U�� �9�9�#�U�#�9�U� �#�t�#�t� #�#�#�#�#� �#�#�#�#�#�#�5�#�#�#�#�5�#�#�#�9�#�#�#�U�#�#�#� �#�#�#�t�#�#�#�#�#�#�#� �9�9�'�U�'�9�U� �'�4�'�4� '�'�'�'�'� �'�'�'�'�'�'�5�'�'�'�'�5�'�'�'�9�'�'�'�U�'�'�'� �'�'�'�4�'�'�'�'�'�'�'� ���� �9�9�#�U�#�9�U� �#�t�#�t� #�#�#�#�#� �#�#�#�#�#�#�5�#�#�#�#�5�#�#�#�9�#�#�#�U�#�#�#� �#�#�#�t�#�#�#�#�#�#�#� �9�9�#�U�#�9�U� �#�t�#�t� #�#�#�#�#� �#�#�#�#�#�#�5�#�#�#�#�5�#�#�#�9�#�#�#�U�#�#�#� �#�#�#�t�#�#�#�#�#�#�#�#r,c�Z^ ^ ^�SSKn[5m Sn/mU U4Sjn/n[U5H5m URUT 4S9nUR U5 UR 5 M7 UHnUR 5 M [T5oUU:Hof(GdC[R"SU4SXQ45S[R"5;d[R"[5(a[R"[5OSS [R"5;d[R"T5(a[R"T5OS [R"U5S [R"5;d[R"U5(a[R"U5OS S .-nS S U0-n[[R"U55eS=pV[U5H�m U 4SjT5n [!U 5o�(d�SS[R"5;d[R"[ 5(a[R"[ 5OS[R"U 5[R"U 5S.-n [[R"U 55eS=p�M� g)z#Test concurrent access to the cacherN�c�z>�SU3nXS.nTRX5 TRTRU55 g)Nzvm-)r1�thread)r@�appendrA)� thread_id�vm_namer4r �resultss ��r*�worker�4test_vm_info_cache_concurrent_access.<locals>.workerMs8���� �{�#��"�8�� � � �'�#����u�y�y��)�*r,)�target�argsr )z0%(py3)s {%(py3)s = %(py0)s(%(py1)s) } == %(py5)srr`� num_threads)r rrrrrc3�2># �UH oST:Hv� M g7f)r\N�)�.0�r�is �r*� <genexpr>�7test_vm_info_cache_concurrent_access.<locals>.<genexpr>_s����5�W��X�;�!�#�W�s�z,assert %(py4)s {%(py4)s = %(py0)s(%(py2)s) }�any)r r r6)� threadingr�range�Threadr]�start�joinrrrrrrrrrrm)rnrera�threads�tr%r!r#r$r r"� @py_format5r rjr`s @@@r*�$test_vm_info_cache_concurrent_accessrvEs����� �M�E��K��G�+� �G� �;� �� � � �F�!�� � 6�����q�� ��� � � �� ����� �w�<�&�;� &�&�&�&�&�<�&�&�&�&�&�&�3�&�&�&�&�3�&�&�&�&�&�&�w�&�&�&�&�w�&�&�&�<�&�&�&�&�&�&�;�&�&�&�&�;�&�&�&�&�&�&�&� �;� ��5�W�5�5�s�5�5�5�5�5�5�5�5�5�5�s�5�5�5�5�s�5�5�5�5�5�5�5�5�5�5�5�5�5�5� r,)�builtinsr�_pytest.assertion.rewrite� assertion�rewriter�pytestrI�kvm_mcp_serverrr+rGrKrUrXrvrgr,r*�<module>r}s0���� � �&�&� -� (� (�$�$6r,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/steveydevey/kvm-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server