Documentation
¶
Overview ¶
Package framework provides testing framework utilities.
Index ¶
- Constants
- Variables
- func BuildCachingServer(t *testing.T) *integration.ManagedProcess
- func BuildEverythingServer(t *testing.T) *integration.ManagedProcess
- func BuildGRPCAuthedWeatherServer(t *testing.T) *integration.ManagedProcess
- func BuildGRPCWeatherServer(t *testing.T) *integration.ManagedProcess
- func BuildHTTPAuthedEchoServer(t *testing.T) *integration.ManagedProcess
- func BuildHTTPEchoServer(t *testing.T) *integration.ManagedProcess
- func BuildOpenAPIAuthedServer(t *testing.T) *integration.ManagedProcess
- func BuildOpenAPIWeatherServer(t *testing.T) *integration.ManagedProcess
- func BuildStdioDockerServer(_ *testing.T) *integration.ManagedProcess
- func BuildStdioServer(_ *testing.T) *integration.ManagedProcess
- func BuildStreamableHTTPServer(t *testing.T) *integration.ManagedProcess
- func BuildWebrtcWeatherServer(t *testing.T) *integration.ManagedProcess
- func BuildWebsocketWeatherServer(t *testing.T) *integration.ManagedProcess
- func NoOpMiddleware(_ *testing.T, next http.Handler) http.Handler
- func RegisterCachingService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterEverythingService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterGRPCAuthedWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterGRPCWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterHTTPAuthedEchoService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterHTTPEchoService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterOpenAPIAuthedService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterOpenAPIWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterStdioDockerService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, _ string)
- func RegisterStdioService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, _ string)
- func RegisterStreamableHTTPService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterWebrtcWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RegisterWebsocketWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, ...)
- func RunE2ETest(t *testing.T, testCase *E2ETestCase)
- func TestE2ECaching(t *testing.T)
- func ValidateCaching(t *testing.T, mcpanyEndpoint, upstreamEndpoint string)
- func ValidateRegisteredTool(t *testing.T, mcpanyEndpoint string, expectedTool *mcp.Tool)
- func VerifyMCPClient(t *testing.T, mcpanyEndpoint string)
- type AITool
- type E2ETestCase
- type GeminiCLI
- type RegistrationMethod
Constants ¶
const DefaultModel = "gemini-2.5-flash"
DefaultModel is the default Gemini model to use.
Variables ¶
var ( FindFreePort = integration.FindFreePort NewManagedProcess = integration.NewManagedProcess WaitForTCPPort = integration.WaitForTCPPort GetProjectRoot = integration.GetProjectRoot ServiceStartupTimeout = 15 * time.Second )
Re-exporting these from the integration package so that framework users don't need to import both.
Functions ¶
func BuildCachingServer ¶
func BuildCachingServer(t *testing.T) *integration.ManagedProcess
BuildCachingServer builds and starts a caching server for testing.
func BuildEverythingServer ¶
func BuildEverythingServer(t *testing.T) *integration.ManagedProcess
BuildEverythingServer builds a server with everything.
func BuildGRPCAuthedWeatherServer ¶
func BuildGRPCAuthedWeatherServer(t *testing.T) *integration.ManagedProcess
BuildGRPCAuthedWeatherServer builds the authenticated gRPC weather server.
func BuildGRPCWeatherServer ¶
func BuildGRPCWeatherServer(t *testing.T) *integration.ManagedProcess
BuildGRPCWeatherServer builds the gRPC weather server.
func BuildHTTPAuthedEchoServer ¶
func BuildHTTPAuthedEchoServer(t *testing.T) *integration.ManagedProcess
BuildHTTPAuthedEchoServer builds the HTTP authed echo server for testing.
func BuildHTTPEchoServer ¶
func BuildHTTPEchoServer(t *testing.T) *integration.ManagedProcess
BuildHTTPEchoServer builds and starts an HTTP echo server for testing.
func BuildOpenAPIAuthedServer ¶
func BuildOpenAPIAuthedServer(t *testing.T) *integration.ManagedProcess
BuildOpenAPIAuthedServer builds the openapi authenticated server.
func BuildOpenAPIWeatherServer ¶
func BuildOpenAPIWeatherServer(t *testing.T) *integration.ManagedProcess
BuildOpenAPIWeatherServer builds the openapi weather server.
func BuildStdioDockerServer ¶
func BuildStdioDockerServer(_ *testing.T) *integration.ManagedProcess
BuildStdioDockerServer builds the stdio docker server (nop).
func BuildStdioServer ¶
func BuildStdioServer(_ *testing.T) *integration.ManagedProcess
BuildStdioServer builds the stdio server (nop).
func BuildStreamableHTTPServer ¶
func BuildStreamableHTTPServer(t *testing.T) *integration.ManagedProcess
BuildStreamableHTTPServer builds the streamable http server.
func BuildWebrtcWeatherServer ¶
func BuildWebrtcWeatherServer(t *testing.T) *integration.ManagedProcess
BuildWebrtcWeatherServer builds the webrtc weather server.
func BuildWebsocketWeatherServer ¶
func BuildWebsocketWeatherServer(t *testing.T) *integration.ManagedProcess
BuildWebsocketWeatherServer builds the websocket weather server.
func NoOpMiddleware ¶
NoOpMiddleware is a middleware that does nothing and calls the next handler.
func RegisterCachingService ¶
func RegisterCachingService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterCachingService registers the caching service with the MCP server.
func RegisterEverythingService ¶
func RegisterEverythingService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterEverythingService registers everything service.
func RegisterGRPCAuthedWeatherService ¶
func RegisterGRPCAuthedWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterGRPCAuthedWeatherService registers the authenticated gRPC weather service.
func RegisterGRPCWeatherService ¶
func RegisterGRPCWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterGRPCWeatherService registers the gRPC weather service.
func RegisterHTTPAuthedEchoService ¶
func RegisterHTTPAuthedEchoService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterHTTPAuthedEchoService registers the HTTP authed echo service with the given registration client.
func RegisterHTTPEchoService ¶
func RegisterHTTPEchoService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterHTTPEchoService registers the HTTP echo service with the MCP server.
func RegisterOpenAPIAuthedService ¶
func RegisterOpenAPIAuthedService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterOpenAPIAuthedService registers the openapi authenticated service.
func RegisterOpenAPIWeatherService ¶
func RegisterOpenAPIWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterOpenAPIWeatherService registers the openapi weather service.
func RegisterStdioDockerService ¶
func RegisterStdioDockerService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, _ string)
RegisterStdioDockerService registers the stdio docker service.
func RegisterStdioService ¶
func RegisterStdioService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, _ string)
RegisterStdioService registers the stdio service.
func RegisterStreamableHTTPService ¶
func RegisterStreamableHTTPService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterStreamableHTTPService registers the streamable http service.
func RegisterWebrtcWeatherService ¶
func RegisterWebrtcWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterWebrtcWeatherService registers the webrtc weather service.
func RegisterWebsocketWeatherService ¶
func RegisterWebsocketWeatherService(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
RegisterWebsocketWeatherService registers the websocket weather service.
func RunE2ETest ¶
func RunE2ETest(t *testing.T, testCase *E2ETestCase)
RunE2ETest runs an end-to-end test case.
func TestE2ECaching ¶
TestE2ECaching tests the end-to-end caching functionality.
func ValidateCaching ¶
ValidateCaching validates that caching is working correctly.
func ValidateRegisteredTool ¶
ValidateRegisteredTool validates that the expected tool is registered.
func VerifyMCPClient ¶
VerifyMCPClient verifies the MCP client.
Types ¶
type AITool ¶
type AITool interface {
Install()
AddMCP(name, endpoint string)
RemoveMCP(name string)
Run(apiKey, model, prompt string) (string, error)
}
AITool represents an AI tool.
type E2ETestCase ¶
type E2ETestCase struct {
Name string
UpstreamServiceType string
BuildUpstream func(t *testing.T) *integration.ManagedProcess
RegisterUpstream func(t *testing.T, registrationClient apiv1.RegistrationServiceClient, upstreamEndpoint string)
ValidateTool func(t *testing.T, mcpanyEndpoint string)
ValidateMiddlewares func(t *testing.T, mcpanyEndpoint string, upstreamEndpoint string)
InvokeAIClient func(t *testing.T, mcpanyEndpoint string)
InvokeAIClientWithServerInfo func(t *testing.T, serverInfo *integration.MCPANYTestServerInfo)
RegistrationMethods []RegistrationMethod
GenerateUpstreamConfig func(_ string) string
StartMCPANYServer func(t *testing.T, testName string, extraArgs ...string) *integration.MCPANYTestServerInfo
RegisterUpstreamWithJSONRPC func(t *testing.T, mcpanyEndpoint, upstreamEndpoint string)
}
E2ETestCase defines the structure for an end-to-end test case.
type GeminiCLI ¶
type GeminiCLI struct {
// contains filtered or unexported fields
}
GeminiCLI handles interactions with the Gemini CLI tool for testing.
func NewGeminiCLI ¶
NewGeminiCLI creates a new GeminiCLI instance.
type RegistrationMethod ¶
type RegistrationMethod string
RegistrationMethod defines the method used to register an upstream service.
const ( // FileRegistration uses a configuration file for registration. FileRegistration RegistrationMethod = "file" // GRPCRegistration uses the RegistrationService via gRPC. GRPCRegistration RegistrationMethod = "grpc" // JSONRPCRegistration uses the RegistrationService via JSON-RPC. JSONRPCRegistration RegistrationMethod = "jsonrpc" )