forked from cleveragents/cleveragents-core
5f7bba3e96
Implement ServerHttpClient with httpx for server communication including: - Health check endpoint (GET /health) - Version negotiation (GET /version, POST /version/negotiate) - Pagination helpers for list endpoints - Per-request timeout and retry policy with exponential backoff - Request/response logging with auth header redaction - TLS verification toggle with warning when disabled - Server error responses mapped to domain errors (A2aNotAvailableError, etc.) - Client-specific exceptions (ServerConnectionError, ServerTimeoutError, ServerVersionMismatchError) - Settings fields: server_base_url, server_api_token, server_tls_verify, server_request_timeout - Factory function create_client_from_settings wired to Settings - httpx added to pyproject.toml dependencies - Behave scenarios (23 scenarios, 72 steps) - Robot Framework smoke tests - ASV benchmark for connection overhead baseline - Reference documentation at docs/reference/server_client_http.md ISSUES CLOSED: #335
82 lines
3.5 KiB
Plaintext
82 lines
3.5 KiB
Plaintext
*** Settings ***
|
|
Documentation Integration tests for Server HTTP client
|
|
Resource ${CURDIR}/common.resource
|
|
Suite Setup Setup Test Environment
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Variables ***
|
|
${HELPER} ${CURDIR}/helper_server_http_client.py
|
|
|
|
*** Test Cases ***
|
|
Server HTTP Client Create
|
|
[Documentation] Verify client construction and property access
|
|
${result}= Run Process ${PYTHON} ${HELPER} client-create cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-create-ok
|
|
|
|
Server HTTP Client Health Check
|
|
[Documentation] Verify health check with mock healthy server
|
|
${result}= Run Process ${PYTHON} ${HELPER} health-check cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-health-ok
|
|
|
|
Server HTTP Client Health Check Failure
|
|
[Documentation] Verify health check returns false for unreachable server
|
|
${result}= Run Process ${PYTHON} ${HELPER} health-check-fail cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-health-fail-ok
|
|
|
|
Server HTTP Client Version
|
|
[Documentation] Verify version retrieval
|
|
${result}= Run Process ${PYTHON} ${HELPER} version cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-version-ok
|
|
|
|
Server HTTP Client Negotiate
|
|
[Documentation] Verify version negotiation
|
|
${result}= Run Process ${PYTHON} ${HELPER} negotiate cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-negotiate-ok
|
|
|
|
Server HTTP Client Pagination
|
|
[Documentation] Verify paginated list endpoint
|
|
${result}= Run Process ${PYTHON} ${HELPER} pagination cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-pagination-ok
|
|
|
|
Server HTTP Client Error 503
|
|
[Documentation] Verify 503 maps to AcpNotAvailableError
|
|
${result}= Run Process ${PYTHON} ${HELPER} error-503 cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-error-503-ok
|
|
|
|
Server HTTP Client Auth Redaction
|
|
[Documentation] Verify auth header redaction
|
|
${result}= Run Process ${PYTHON} ${HELPER} redaction cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-redaction-ok
|
|
|
|
Server HTTP Client Exceptions
|
|
[Documentation] Verify client exception attributes
|
|
${result}= Run Process ${PYTHON} ${HELPER} exceptions cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} server-http-client-exceptions-ok
|