functional

package
v0.0.0-...-bef5c4b Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ContentTypeHeader              = "Content-Type"
	LambdaInvocationIDHeader       = "Lambda-Runtime-Aws-Request-Id"
	LambdaInvocationDeadlineHeader = "Lambda-Runtime-Deadline-Ms"
	LambdaErrorTypeHeader          = "Lambda-Runtime-Function-Error-Type"
	LambdaErrorBodyHeader          = "Lambda-Runtime-Function-Error-Body"
	LambdaResponseModeHeader       = "Lambda-Runtime-Function-Response-Mode"
	LambdaXRayErrorCauseHeader     = "Lambda-Runtime-Function-XRay-Error-Cause"
)

Variables

This section is empty.

Functions

func HttpGetWithHeaders

func HttpGetWithHeaders(client *http.Client, url string, headers *map[string]string) (*http.Response, error)

func HttpPostWithHeaders

func HttpPostWithHeaders(client *http.Client, url string, data []byte, headers *map[string]string) (*http.Response, error)

func MakeMockFileUtil

func MakeMockFileUtil(extensions ExtensionsEnv) *utils.MockFileUtil

func SetupMockFileUtil

func SetupMockFileUtil(extensions ExtensionsEnv, hasBootstrap bool, hasVarTask bool) *utils.MockFileUtil

Types

type ChunkedReader

type ChunkedReader struct {
	// contains filtered or unexported fields
}

func NewChunkedReader

func NewChunkedReader(chunks []string, delay time.Duration) *ChunkedReader

func (*ChunkedReader) Read

func (r *ChunkedReader) Read(p []byte) (n int, err error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint netip.AddrPort) *Client

func NewExtensionsClient

func NewExtensionsClient(endpoint netip.AddrPort) *Client

func (*Client) ExtensionsExitError

func (client *Client) ExtensionsExitError(agentIdentifier, functionErrorType, payload string) (*StatusResponse, errorExtensions)

func (*Client) ExtensionsInitError

func (client *Client) ExtensionsInitError(agentIdentifier, functionErrorType, payload string) (*StatusResponse, errorExtensions)

func (*Client) ExtensionsNext

func (client *Client) ExtensionsNext(agentIdentifier string) (interface{}, errorExtensions)

func (*Client) ExtensionsNextWithHeaders

func (client *Client) ExtensionsNextWithHeaders(headers map[string]string) (interface{}, errorExtensions)

func (*Client) ExtensionsRegister

func (client *Client) ExtensionsRegister(agentUniqueName string, events []Event) (*http.Response, errorExtensions)

func (*Client) ExtensionsSleep

func (client *Client) ExtensionsSleep(d time.Duration)

func (*Client) ExtensionsTelemetrySubscribe

func (client *Client) ExtensionsTelemetrySubscribe(agentIdentifier string, agentName string, body io.Reader, headers map[string][]string, remoteAddr string) (*http.Response, errorExtensions)

func (*Client) InitError

func (client *Client) InitError(payload string, contentType string, errorType string) (*http.Response, error)

func (*Client) Next

func (client *Client) Next(body io.Reader) *http.Response

func (*Client) Response

func (client *Client) Response(invokeID interop.InvokeID, payload io.Reader, contentType string, responseModeHeader string, trailers map[string]string) (*http.Response, error)

func (*Client) ResponseError

func (client *Client) ResponseError(invokeID interop.InvokeID, payload string, contentType string, errorType string, errorCause string) (*http.Response, error)

func (*Client) ResponseErrorWithHeaders

func (client *Client) ResponseErrorWithHeaders(invokeID interop.InvokeID, payload string, headers map[string]string) (*http.Response, error)

func (*Client) ResponseWithHeaders

func (client *Client) ResponseWithHeaders(invokeID interop.InvokeID, payload io.Reader, contentType string, responseModeHeader string, trailers map[string]string, extraHeaders map[string]string) (*http.Response, error)

type ConfigKey

type ConfigKey string

type Event

type Event string
const (
	Shutdown Event = "SHUTDOWN"
)

type EventType

type EventType string
const (
	PlatformInitStart       EventType = "platform.initStart"
	PlatformInitRuntimeDone EventType = "platform.initRuntimeDone"
	PlatformInitReport      EventType = "platform.initReport"
	PlatformRuntimeStart    EventType = "platform.runtimeStart"
	PlatformReport          EventType = "platform.report"
)

type ExecutionEnvironmentAction

type ExecutionEnvironmentAction interface {
	Execute(t *testing.T, client *Client) (*http.Response, error)
	ValidateStatus(t *testing.T, resp *http.Response)
	String() string
}

type ExitAction

type ExitAction struct {
	ExitCode int32

	CrashingProcessName string
	// contains filtered or unexported fields
}

func (ExitAction) Execute

func (a ExitAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (ExitAction) String

func (a ExitAction) String() string

func (ExitAction) ValidateStatus

func (a ExitAction) ValidateStatus(t *testing.T, resp *http.Response)

type ExpectedExtensionEvents

type ExpectedExtensionEvents struct {
	ExtensionName string
	State         string
	ErrorType     string
}

type ExpectedGlobalData

type ExpectedGlobalData struct {
	FunctionARN     string
	FunctionVersion string
}

type ExpectedInitEvent

type ExpectedInitEvent struct {
	EventType EventType
	Status    string
	ErrorType string
}

type ExpectedInvokeEvents

type ExpectedInvokeEvents struct {
	EventType EventType

	Status string

	Spans []string
}

type ExtensionTelemetrySubscribeAction

type ExtensionTelemetrySubscribeAction struct {
	AgentIdentifier string
	AgentName       string

	Payload io.Reader

	Headers map[string][]string

	RemoteAddr string

	ExpectedStatus int

	ExpectedErrorType string

	ExpectedErrorMessage string
}

func (ExtensionTelemetrySubscribeAction) Execute

func (ExtensionTelemetrySubscribeAction) String

func (ExtensionTelemetrySubscribeAction) ValidateStatus

func (a ExtensionTelemetrySubscribeAction) ValidateStatus(t *testing.T, resp *http.Response)

type ExtensionsEnv

type ExtensionsEnv = map[string]*ExtensionsExecutionEnvironment

type ExtensionsExecutionEnvironment

type ExtensionsExecutionEnvironment struct {
	Actions []ExecutionEnvironmentAction

	ForcedError error

	ExtensionIdentifier uuid.UUID
	T                   *testing.T
	ExitProcessOnce     func()
	Stdout, Stderr      io.Writer
	Done                sync.WaitGroup
}

func (*ExtensionsExecutionEnvironment) Exec

func (e *ExtensionsExecutionEnvironment) Exec(request *model.ExecRequest) (<-chan struct{}, error)

func (*ExtensionsExecutionEnvironment) Kill

func (*ExtensionsExecutionEnvironment) Terminate

func (e *ExtensionsExecutionEnvironment) Terminate() error

type ExtensionsExitErrorAction

type ExtensionsExitErrorAction struct {
	AgentIdentifier   string
	FunctionErrorType string
	Payload           string
	ExpectedStatus    int
}

func (ExtensionsExitErrorAction) Execute

func (a ExtensionsExitErrorAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (ExtensionsExitErrorAction) String

func (a ExtensionsExitErrorAction) String() string

func (ExtensionsExitErrorAction) ValidateStatus

func (a ExtensionsExitErrorAction) ValidateStatus(t *testing.T, resp *http.Response)

type ExtensionsInitErrorAction

type ExtensionsInitErrorAction struct {
	AgentIdentifier   string
	FunctionErrorType string
	Payload           string
	ExpectedStatus    int
}

func (ExtensionsInitErrorAction) Execute

func (a ExtensionsInitErrorAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (ExtensionsInitErrorAction) String

func (a ExtensionsInitErrorAction) String() string

func (ExtensionsInitErrorAction) ValidateStatus

func (a ExtensionsInitErrorAction) ValidateStatus(t *testing.T, resp *http.Response)

type ExtensionsNextAction

type ExtensionsNextAction struct {
	AgentIdentifier string
	ExpectedStatus  int
}

func (ExtensionsNextAction) Execute

func (a ExtensionsNextAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (ExtensionsNextAction) String

func (a ExtensionsNextAction) String() string

func (ExtensionsNextAction) ValidateStatus

func (a ExtensionsNextAction) ValidateStatus(t *testing.T, resp *http.Response)

type ExtensionsNextParallelAction

type ExtensionsNextParallelAction struct {
	AgentIdentifier string
	ExpectedStatus  int
	ParallelActions []ExecutionEnvironmentAction
	Environment     *ExtensionsExecutionEnvironment
}

func (ExtensionsNextParallelAction) Execute

func (a ExtensionsNextParallelAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (ExtensionsNextParallelAction) String

func (ExtensionsNextParallelAction) ValidateStatus

func (a ExtensionsNextParallelAction) ValidateStatus(t *testing.T, resp *http.Response)

type ExtensionsRegisterAction

type ExtensionsRegisterAction struct {
	AgentUniqueName string

	Events         []Event
	ExpectedStatus int
}

func (ExtensionsRegisterAction) Execute

func (a ExtensionsRegisterAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (ExtensionsRegisterAction) String

func (a ExtensionsRegisterAction) String() string

func (ExtensionsRegisterAction) ValidateStatus

func (a ExtensionsRegisterAction) ValidateStatus(t *testing.T, resp *http.Response)

type ExtensionsTelemetryAPIHTTPSubscriberAction

type ExtensionsTelemetryAPIHTTPSubscriberAction struct {
	Subscription      ExtensionTelemetrySubscribeAction
	InMemoryEventsApi *InMemoryEventsApi
	// contains filtered or unexported fields
}

func (ExtensionsTelemetryAPIHTTPSubscriberAction) Execute

func (ExtensionsTelemetryAPIHTTPSubscriberAction) String

func (ExtensionsTelemetryAPIHTTPSubscriberAction) ValidateStatus

type ExtensionsTelemetryAPITCPSubscriberAction

type ExtensionsTelemetryAPITCPSubscriberAction struct {
	Subscription      ExtensionTelemetrySubscribeAction
	InMemoryEventsApi *InMemoryEventsApi
	// contains filtered or unexported fields
}

func (ExtensionsTelemetryAPITCPSubscriberAction) Execute

func (ExtensionsTelemetryAPITCPSubscriberAction) String

func (ExtensionsTelemetryAPITCPSubscriberAction) ValidateStatus

func (a ExtensionsTelemetryAPITCPSubscriberAction) ValidateStatus(t *testing.T, resp *http.Response)

type FluxPumpServer

type FluxPumpServer struct {
	// contains filtered or unexported fields
}

func NewFluxPumpServer

func NewFluxPumpServer() *FluxPumpServer

func (*FluxPumpServer) GetAddrPort

func (s *FluxPumpServer) GetAddrPort() netip.AddrPort

func (*FluxPumpServer) GetRequests

func (s *FluxPumpServer) GetRequests() []SubscribeRequestLog

func (*FluxPumpServer) ServeHTTP

func (s *FluxPumpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*FluxPumpServer) Start

func (s *FluxPumpServer) Start(fxPumpAddrPort netip.AddrPort) error

func (*FluxPumpServer) Stop

func (s *FluxPumpServer) Stop() error

type InMemoryEventsApi

type InMemoryEventsApi struct {
	InvokeXRAYErrorCause map[interop.InvokeID]interop.InternalXRayErrorCauseData
	// contains filtered or unexported fields
}

func NewInMemoryEventsApi

func NewInMemoryEventsApi(t *testing.T) *InMemoryEventsApi

func (*InMemoryEventsApi) CheckComprehensiveInitExpectations

func (e *InMemoryEventsApi) CheckComprehensiveInitExpectations(startTimestamp time.Time, finishTimestamp time.Time, expectedMinimalInitDuration time.Duration, expectedInitEvents []ExpectedInitEvent, initReq model.InitRequestMessage)

func (*InMemoryEventsApi) CheckComprehensiveInvokeExpectations

func (e *InMemoryEventsApi) CheckComprehensiveInvokeExpectations(startTimestamp time.Time, finishTimestamp time.Time, invokeID interop.InvokeID, expectedInvokeEvents []ExpectedInvokeEvents, initReq model.InitRequestMessage, expectedInvokeLatency time.Duration, expectedInvokeRespDuration time.Duration)

func (*InMemoryEventsApi) CheckSimpleExtensionExpectations

func (e *InMemoryEventsApi) CheckSimpleExtensionExpectations(expectedExtensionsEvents []ExpectedExtensionEvents)

func (*InMemoryEventsApi) CheckSimpleInitExpectations

func (e *InMemoryEventsApi) CheckSimpleInitExpectations(startTimestamp time.Time, finishTimestamp time.Time, expectedInitEvents []ExpectedInitEvent, initReq model.InitRequestMessage)

func (*InMemoryEventsApi) CheckSimpleInvokeExpectations

func (e *InMemoryEventsApi) CheckSimpleInvokeExpectations(startTimestamp time.Time, finishTimestamp time.Time, invokeID interop.InvokeID, expectedInvokeEvents []ExpectedInvokeEvents, initReq model.InitRequestMessage)

func (*InMemoryEventsApi) CheckXRayErrorCauseExpectations

func (e *InMemoryEventsApi) CheckXRayErrorCauseExpectations(invokeID interop.InvokeID, expectedErrorCause string)

func (*InMemoryEventsApi) Flush

func (e *InMemoryEventsApi) Flush()

func (*InMemoryEventsApi) LogLines

func (e *InMemoryEventsApi) LogLines() []telemetry.Event

func (*InMemoryEventsApi) RecordLogLine

func (e *InMemoryEventsApi) RecordLogLine(ev telemetry.Event)

func (*InMemoryEventsApi) SendExtensionInit

func (e *InMemoryEventsApi) SendExtensionInit(data interop.ExtensionInitData) error

func (*InMemoryEventsApi) SendImageError

func (e *InMemoryEventsApi) SendImageError(errLog interop.ImageErrorLogData)

func (*InMemoryEventsApi) SendInitReport

func (e *InMemoryEventsApi) SendInitReport(data interop.InitReportData) error

func (*InMemoryEventsApi) SendInitRuntimeDone

func (e *InMemoryEventsApi) SendInitRuntimeDone(data interop.InitRuntimeDoneData) error

func (*InMemoryEventsApi) SendInitStart

func (e *InMemoryEventsApi) SendInitStart(data interop.InitStartData) error

func (*InMemoryEventsApi) SendInternalXRayErrorCause

func (e *InMemoryEventsApi) SendInternalXRayErrorCause(data interop.InternalXRayErrorCauseData) error

func (*InMemoryEventsApi) SendInvokeStart

func (e *InMemoryEventsApi) SendInvokeStart(data interop.InvokeStartData) error

func (*InMemoryEventsApi) SendReport

func (e *InMemoryEventsApi) SendReport(data interop.ReportData) error

type InitErrorAction

type InitErrorAction struct {
	Payload        string
	ContentType    string
	ErrorType      string
	ExpectedStatus int
}

func (InitErrorAction) Execute

func (a InitErrorAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (InitErrorAction) String

func (a InitErrorAction) String() string

func (InitErrorAction) ValidateStatus

func (a InitErrorAction) ValidateStatus(t *testing.T, resp *http.Response)

type InvocationResponseAction

type InvocationResponseAction struct {
	Payload            io.Reader
	ContentType        string
	InvokeID           interop.InvokeID
	ResponseModeHeader string
	ResponseHeaders    map[string]string
	ExpectedStatus     int
	ExpectedBody       string
	Trailers           map[string]string
}

func (InvocationResponseAction) Execute

func (a InvocationResponseAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (InvocationResponseAction) String

func (a InvocationResponseAction) String() string

func (InvocationResponseAction) ValidateStatus

func (a InvocationResponseAction) ValidateStatus(t *testing.T, resp *http.Response)

type InvocationResponseErrorAction

type InvocationResponseErrorAction struct {
	Payload         string
	ContentType     string
	InvokeID        interop.InvokeID
	ErrorType       string
	ErrorCause      string
	ResponseHeaders map[string]string
	ExpectedStatus  int
	ExpectedBody    string
}

func (InvocationResponseErrorAction) Execute

func (a InvocationResponseErrorAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (InvocationResponseErrorAction) String

func (InvocationResponseErrorAction) ValidateStatus

func (a InvocationResponseErrorAction) ValidateStatus(t *testing.T, resp *http.Response)

type InvocationStreamingResponseAction

type InvocationStreamingResponseAction struct {
	Chunks             []string
	Body               io.Reader
	ContentType        string
	InvokeID           interop.InvokeID
	ResponseModeHeader string
	ChunkDelay         time.Duration
	Trailers           map[string]string
}

func (InvocationStreamingResponseAction) Execute

func (InvocationStreamingResponseAction) String

func (InvocationStreamingResponseAction) ValidateStatus

func (a InvocationStreamingResponseAction) ValidateStatus(t *testing.T, resp *http.Response)

type MockSupervisor

type MockSupervisor struct {
	// contains filtered or unexported fields
}

func NewMockSupervisor

func NewMockSupervisor(t *testing.T, runtime process, extensions ExtensionsEnv, eventsErr error) *MockSupervisor

func (*MockSupervisor) Events

func (m *MockSupervisor) Events(_ context.Context) (<-chan model.Event, error)

func (*MockSupervisor) Exec

func (m *MockSupervisor) Exec(_ context.Context, request *model.ExecRequest) error

func (*MockSupervisor) Kill

func (m *MockSupervisor) Kill(_ context.Context, request *model.KillRequest) error

func (*MockSupervisor) Terminate

func (m *MockSupervisor) Terminate(_ context.Context, request *model.TerminateRequest) error

type NextAction

type NextAction struct {
	Payload        string
	ExpectedStatus int
}

func (NextAction) Execute

func (a NextAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (NextAction) String

func (a NextAction) String() string

func (NextAction) ValidateStatus

func (a NextAction) ValidateStatus(t *testing.T, resp *http.Response)

type NextResponse

type NextResponse struct {
	EventType Event `json:"eventType"`
}

type RapidHTTPError

type RapidHTTPError struct {
	StatusCode int
	Status     string
}

func (*RapidHTTPError) Error

func (s *RapidHTTPError) Error() string

type RegisterRequest

type RegisterRequest struct {
	Events []Event
}

type RuntimeEnv

type RuntimeEnv struct {
	Workers []RuntimeExecutionEnvironment

	ForcedError      error
	T                *testing.T
	ExitProcessOnce  func()
	Stdout, Stderr   io.Writer
	InvokeResponseWG *sync.WaitGroup
	Done             sync.WaitGroup
}

func (*RuntimeEnv) Exec

func (r *RuntimeEnv) Exec(request *model.ExecRequest) (<-chan struct{}, error)

func (*RuntimeEnv) Kill

func (r *RuntimeEnv) Kill() error

func (*RuntimeEnv) Terminate

func (r *RuntimeEnv) Terminate() error

type RuntimeExecutionEnvironment

type RuntimeExecutionEnvironment struct {
	Actions      []ExecutionEnvironmentAction
	InvokeID     interop.InvokeID
	InvocationID string
	RuntimeEnv   *RuntimeEnv
}

type ShutdownResponse

type ShutdownResponse struct {
	*NextResponse
	ShutdownReason string `json:"shutdownReason"`
	DeadlineMs     int64  `json:"deadlineMs"`
}

type SleepAction

type SleepAction struct {
	Duration time.Duration
}

func (SleepAction) Execute

func (a SleepAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (SleepAction) String

func (a SleepAction) String() string

func (SleepAction) ValidateStatus

func (a SleepAction) ValidateStatus(t *testing.T, resp *http.Response)

type SleepExtensionAction

type SleepExtensionAction struct {
	Duration time.Duration
}

func (SleepExtensionAction) Execute

func (a SleepExtensionAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (SleepExtensionAction) String

func (a SleepExtensionAction) String() string

func (SleepExtensionAction) ValidateStatus

func (a SleepExtensionAction) ValidateStatus(t *testing.T, resp *http.Response)

type StatusResponse

type StatusResponse struct {
	Status string `json:"status"`
}

type StderrAction

type StderrAction struct {
	Payload string
	// contains filtered or unexported fields
}

func (StderrAction) Execute

func (a StderrAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (StderrAction) String

func (a StderrAction) String() string

func (StderrAction) ValidateStatus

func (a StderrAction) ValidateStatus(t *testing.T, resp *http.Response)

type StdoutAction

type StdoutAction struct {
	Payload string
	// contains filtered or unexported fields
}

func (StdoutAction) Execute

func (a StdoutAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (StdoutAction) String

func (a StdoutAction) String() string

func (StdoutAction) ValidateStatus

func (a StdoutAction) ValidateStatus(t *testing.T, resp *http.Response)

type SubscribeRequestLog

type SubscribeRequestLog struct {
	AgentName  string
	Passphrase string
	Body       []byte
	Headers    map[string][]string
	RemoteAddr string
	Timestamp  time.Time
}

type WaitInvokeResponseAction

type WaitInvokeResponseAction struct {
	// contains filtered or unexported fields
}

func (WaitInvokeResponseAction) Execute

func (a WaitInvokeResponseAction) Execute(t *testing.T, client *Client) (*http.Response, error)

func (WaitInvokeResponseAction) String

func (a WaitInvokeResponseAction) String() string

func (WaitInvokeResponseAction) ValidateStatus

func (a WaitInvokeResponseAction) ValidateStatus(t *testing.T, resp *http.Response)

Jump to

Keyboard shortcuts

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