mockairlock

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock struct {
	Server *httptest.Server

	// LLMResponse is the NDJSON response returned by the model endpoint.
	LLMResponse []byte
	// BeforeLLMResponse, when set, runs after the request is recorded and before
	// response headers or events are written.
	BeforeLLMResponse func()
	// EnqueueJobResponse and GetJobResponse override the default job responses.
	EnqueueJobResponse *wire.EnqueueJobResponse
	EnqueueJobError    *wire.EnqueueJobErrorResponse
	GetJobResponse     *wire.GetJobResponse
	RunCompleteStatus  int
	JobProgressStatus  int
	// contains filtered or unexported fields
}

Mock is an httptest server that implements the Airlock agent API.

func New

func New() (*Mock, string)

New creates a mock Airlock server and returns it with its base URL.

func NewWithLLMResponse

func NewWithLLMResponse(response func() []byte) (*Mock, string)

NewWithLLMResponse creates a mock whose model response is supplied per call.

func (*Mock) Close

func (m *Mock) Close()

Close shuts down the mock server.

func (*Mock) Requests

func (m *Mock) Requests() []Request

Requests returns all recorded requests.

func (*Mock) RequestsByPath

func (m *Mock) RequestsByPath(prefix string) []Request

RequestsByPath returns requests matching the path prefix.

func (*Mock) Reset

func (m *Mock) Reset()

Reset clears all recorded requests.

type Request

type Request struct {
	Method string
	Path   string
	Body   []byte
	Header http.Header
}

Request records a request made to the mock Airlock server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL