Files
gpu-rent/tests/test_public_net_sg.py
Leonid PershinandCursor 9e9f72c1ac Refactor public network API handling and enhance connectivity checks
- 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>
2026-08-23 18:55:19 +03:00

22 lines
684 B
Python

"""SG for direct public IP uses compute-pool Neutron (openstacksdk)."""
from unittest.mock import MagicMock
from gpu_rent.public_net import SecurityGroupRef, ensure_public_network_security_group
def test_public_network_sg_uses_sdk(monkeypatch):
main_conn = MagicMock()
def fake_ensure_sg(conn, cidr, log):
assert conn is main_conn
assert cidr == "0.0.0.0/0"
return MagicMock(id="sg-ru6")
monkeypatch.setattr("gpu_rent.cloud.ensure_security_group", fake_ensure_sg)
sg = ensure_public_network_security_group(
main_conn, "0.0.0.0/0", "ru-6", lambda _m: None
)
assert sg == SecurityGroupRef(id="sg-ru6")