Skip to content

Commit 9c750a6

Browse files
Reconnect gRPC client in integration tests
The gRPC client is a singleton and its internal state can be corrupted when used concurrently from multiple async contexts. Reconnecting ensures that the client is in a clean state for each test. Signed-off-by: Daniel Zullo <[email protected]>
1 parent ef0499e commit 9c750a6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

integration_tests/test_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ async def set_up() -> dict[str, Any]:
4646
server_url=SERVER_URL,
4747
auth_key=API_KEY,
4848
)
49+
# The gRPC client is a singleton and its internal state can be corrupted
50+
# when used concurrently from multiple async contexts. Reconnecting
51+
# ensures that the client is in a clean state for each test.
52+
await client.disconnect()
53+
client.connect()
4954

5055
delivery_area = DeliveryArea(
5156
code="10YDE-EON------1", code_type=EnergyMarketCodeType.EUROPE_EIC

0 commit comments

Comments
 (0)