- Updated the public network handling to resolve the base URL dynamically based on Keystone catalog. - Simplified the public network pool function to directly return the compute region. - Enhanced error messages in the doctor command for better clarity on public network status. - Introduced new functions for managing security groups and ensuring visibility of public ports in Neutron. Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""public-network API pool = compute pool (OS_REGION_NAME)."""
|
|
|
|
from unittest.mock import MagicMock
|
|
|
|
from gpu_rent.public_net import (
|
|
public_net_base,
|
|
public_network_pool,
|
|
resolve_public_net_base,
|
|
)
|
|
|
|
|
|
def test_public_network_pool_is_compute_region():
|
|
assert public_network_pool("ru-6") == "ru-6"
|
|
assert public_network_pool("ru-7") == "ru-7"
|
|
|
|
|
|
def test_public_net_base_uses_compute_pool():
|
|
assert public_net_base("ru-6") == (
|
|
"https://ru-6.cloud.api.selcloud.ru/public-network"
|
|
)
|
|
assert public_net_base("ru-7") == (
|
|
"https://ru-7.cloud.api.selcloud.ru/public-network"
|
|
)
|
|
|
|
|
|
def test_resolve_public_net_base_from_keystone_catalog():
|
|
conn = MagicMock()
|
|
conn.session.get_endpoint.return_value = (
|
|
"https://ru-6.cloud.api.selcloud.ru/public-network/v1/"
|
|
)
|
|
assert resolve_public_net_base(conn, "ru-6") == (
|
|
"https://ru-6.cloud.api.selcloud.ru/public-network/v1"
|
|
)
|
|
conn.session.get_endpoint.assert_called()
|