MCPcopy Create free account
hub / github.com/StackStorm/st2 / mock_st2cluster

Function mock_st2cluster

pants-plugins/uses_services/st2cluster_rules_test.py:68–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66
67@pytest.fixture
68def mock_st2cluster() -> tuple[int, int, int]:
69 sock1: socket.socket
70 sock2: socket.socket
71 sock3: socket.socket
72 with (
73 closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock1,
74 closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock2,
75 closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock3,
76 ):
77 socks = (sock1, sock2, sock3)
78 for sock in socks:
79 sock.bind(("127.0.0.1", 0))
80 sock.listen(1)
81 ports = tuple(sock.getsockname()[1] for sock in socks)
82 yield ports
83
84
85# Warning this requires that st2cluster be running

Callers

nothing calls this directly

Calls 1

listenMethod · 0.80

Tested by

no test coverage detected