mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-20 10:57:22 +08:00
63 lines
2.5 KiB
Markdown
63 lines
2.5 KiB
Markdown
# Internal Integration Tests Specification
|
|
|
|
## ADDED Requirements
|
|
|
|
### Requirement: MCP client integration with echo server
|
|
|
|
The MCP client SHALL be able to connect to a real MCP echo server fixture and perform tool operations.
|
|
|
|
#### Scenario: MCP client initialization
|
|
- **WHEN** McpClient is instantiated
|
|
- **THEN** client exists with `connected = False`
|
|
|
|
#### Scenario: MCP client connect without config is noop
|
|
- **WHEN** `connect()` is called without server configuration
|
|
- **THEN** client remains in disconnected state
|
|
|
|
#### Scenario: MCP client connects to echo server (deferred)
|
|
- **WHEN** MCP client attempts to connect to echo MCP server
|
|
- **THEN** connection is established and verified
|
|
- **NOTE**: Test skipped - MCP ClientSession.initialize() protocol handshake is complex
|
|
|
|
#### Scenario: MCP client lists tools from server (deferred)
|
|
- **WHEN** `list_tools()` is called on connected client
|
|
- **THEN** returns list of available tools from server
|
|
- **NOTE**: Test skipped due to protocol complexity
|
|
|
|
#### Scenario: MCP client calls echo tool (deferred)
|
|
- **WHEN** `call_tool("echo", {"message": "test"})` is called
|
|
- **THEN** returns echoed result
|
|
- **NOTE**: Test skipped due to protocol complexity
|
|
|
|
### Requirement: ACP client integration with echo server
|
|
|
|
The ACP client SHALL be able to connect to a real ACP echo server fixture over TCP and Unix sockets.
|
|
|
|
#### Scenario: ACP client initial state
|
|
- **WHEN** AstrbotAcpClient is instantiated
|
|
- **THEN** `connected = False`, `_reader = None`, `_writer = None`
|
|
|
|
#### Scenario: ACP client connects to TCP server
|
|
- **WHEN** `connect_to_server(host, port)` is called with TCP echo server
|
|
- **THEN** client connects successfully with `connected = True`
|
|
- **AND** `_reader` and `_writer` are set
|
|
|
|
#### Scenario: ACP client connects to Unix socket
|
|
- **WHEN** `connect_to_unix_socket(socket_path)` is called with Unix socket echo server
|
|
- **THEN** client connects successfully with `connected = True`
|
|
- **AND** `_reader` and `_writer` are set
|
|
|
|
### Requirement: Integration test fixtures
|
|
|
|
The integration test fixtures SHALL provide real protocol servers for testing.
|
|
|
|
#### Scenario: Echo MCP server handles stdio protocol
|
|
- **WHEN** MCP server receives JSON-RPC request on stdin
|
|
- **THEN** responds with proper Content-Length headers on stdout
|
|
- **AND** handles `initialize`, `tools/list`, `tools/call` methods
|
|
|
|
#### Scenario: Echo ACP server handles stream protocol
|
|
- **WHEN** ACP server receives request on TCP/Unix socket
|
|
- **THEN** responds with JSON-RPC responses
|
|
- **AND** handles `initialize`, `echo`, and `{server}/{tool}` methods
|