Documentation
¶
Overview ¶
Package gatewaytest starts a real sailwright-gateway against a fake sailwright CLI. It is shared by the gateway integration tests and the E2E module's self-test.
Index ¶
- Constants
- func BuildFakeCLI(t testing.TB) string
- type Harness
- func (h *Harness) Approve(t testing.TB, jobID string)
- func (h *Harness) ApproveSudo(t testing.TB, jobID string, password string)
- func (h *Harness) Connect(t testing.TB) *mcp.ClientSession
- func (h *Harness) ConnectTo(t testing.TB, endpoint client.Endpoint) *mcp.ClientSession
- func (h *Harness) Deny(t testing.TB, jobID string)
- func (h *Harness) Invocations(t testing.TB) []Invocation
- func (h *Harness) SocketEndpoint() client.Endpoint
- func (h *Harness) TCPEndpoint() client.Endpoint
- func (h *Harness) WaitForPrompt(t testing.TB, jobID string)
- type Invocation
- type Options
- type SyncBuffer
Constants ¶
const AgentWorkspace = "/workspaces/test"
AgentWorkspace is the agent-side path mapped to Harness.WorkspaceHost.
Variables ¶
This section is empty.
Functions ¶
func BuildFakeCLI ¶
BuildFakeCLI compiles the fake sailwright CLI once per test process.
Types ¶
type Harness ¶
type Harness struct {
URL string
SocketPath string
ViewURL string
AgentDir string
Token string
StateDir string
RecordFile string
FakeStateDir string
WorkspaceHost string
Gateway *gateway.Gateway
Console *SyncBuffer
// contains filtered or unexported fields
}
Harness is a running gateway with a fake CLI behind it.
func (*Harness) ApproveSudo ¶
ApproveSudo approves jobID with a sudo password, as the operator would type it.
func (*Harness) Connect ¶
func (h *Harness) Connect(t testing.TB) *mcp.ClientSession
Connect opens an MCP client session over TCP with the harness token.
func (*Harness) Invocations ¶
func (h *Harness) Invocations(t testing.TB) []Invocation
Invocations returns every recorded fake CLI call.
func (*Harness) SocketEndpoint ¶
SocketEndpoint returns the Unix socket endpoint (empty Socket on Windows).
func (*Harness) TCPEndpoint ¶
TCPEndpoint returns the TCP endpoint with the harness token.
type Invocation ¶
type Invocation struct {
Argv []string `json:"argv"`
Cwd string `json:"cwd"`
Env []string `json:"env"`
}
Invocation is one recorded fake CLI call.
type Options ¶
type Options struct {
Approvals bool
ApprovalTTL time.Duration
PullAllowlist []string
JobTimeout string
FollowOutput bool
// LiveTail receives the running job's output for the terminal tail.
LiveTail gateway.LiveTail
// GateForeignVMs enables the rule that VMs the gateway did not create need
// operator approval (on in real gateways; off by default in tests).
GateForeignVMs bool
// AutoApprovals uses the --bypass-approvals approver instead of the console.
AutoApprovals bool
// NoWorkspace leaves agent_workspaces in gateway.yaml empty, as on a fresh host.
NoWorkspace bool
}
Options configure a test gateway.
type SyncBuffer ¶
type SyncBuffer struct {
// contains filtered or unexported fields
}
SyncBuffer is a goroutine-safe text buffer.