-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathtest_inprocess_ffi_e2e.py
More file actions
34 lines (24 loc) · 1.17 KB
/
Copy pathtest_inprocess_ffi_e2e.py
File metadata and controls
34 lines (24 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""E2E smoke test for the in-process (FFI) transport.
Starts a client over the in-process FFI transport, performs a ``ping``
round-trip through the native runtime library, and stops cleanly. Resolution of
the transport from ``COPILOT_SDK_DEFAULT_CONNECTION`` is exercised by the full
E2E suite running under the ``inprocess`` CI matrix cell, not here.
Mirrors nodejs/test/e2e/inprocess_ffi.e2e.test.ts.
"""
from __future__ import annotations
import pytest
from copilot import CopilotClient, RuntimeConnection
from .testharness import E2ETestContext
pytestmark = pytest.mark.asyncio(loop_scope="module")
class TestInProcessFfi:
async def test_should_start_and_connect_over_in_process_ffi(self, ctx: E2ETestContext):
# In-process hosting loads runtime.node directly. ``ping`` is a purely local
# RPC round-trip, so no auth or replay proxy is involved.
client = CopilotClient(connection=RuntimeConnection.for_inprocess())
await client.start()
try:
pong = await client.ping("ffi message")
assert pong.message == "pong: ffi message"
assert pong.timestamp is not None
finally:
await client.stop()