lambda

package
v0.0.0-...-62f60b2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionLatest = "$LATEST"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LambdaAPI

type LambdaAPI interface {
	Invoke(input *lambdasvc.InvokeInput) (*lambdasvc.InvokeOutput, error)
}

type ResponseExpectations

type ResponseExpectations struct {
	FunctionError        string
	Payload              interface{}
	Status               int
	Version              string
	WantExactJSONPayload bool
}

type TestCase

type TestCase struct {
	Desc         string
	FunctionID   string
	HandlerFn    interface{}
	Payload      interface{}
	Expectations ResponseExpectations
	// contains filtered or unexported fields
}

func Handle

func Handle(handlerFn interface{}, description ...string) *TestCase

func Invoke

func Invoke(functionID string, description ...string) *TestCase

func (*TestCase) Action

func (tc *TestCase) Action() string

func (*TestCase) AsDryRun

func (tc *TestCase) AsDryRun() *TestCase

func (*TestCase) Describe

func (tc *TestCase) Describe(description string) *TestCase

func (*TestCase) Description

func (tc *TestCase) Description() string

func (*TestCase) Execute

func (tc *TestCase) Execute(t *testing.T) (mt.TestResult, error)

func (*TestCase) ExpectExactPayload

func (tc *TestCase) ExpectExactPayload(payload interface{}) *TestCase

func (*TestCase) ExpectFunctionError

func (tc *TestCase) ExpectFunctionError(err string) *TestCase

func (*TestCase) ExpectPayload

func (tc *TestCase) ExpectPayload(payload interface{}) *TestCase

func (*TestCase) ExpectStatus

func (tc *TestCase) ExpectStatus(status int) *TestCase

func (*TestCase) ExpectVersion

func (tc *TestCase) ExpectVersion(version string) *TestCase

func (*TestCase) Target

func (tc *TestCase) Target() string

func (*TestCase) WithExecutionLogs

func (tc *TestCase) WithExecutionLogs() *TestCase

func (*TestCase) WithPayload

func (tc *TestCase) WithPayload(payload interface{}) *TestCase

type TestContext

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

func DefaultContext

func DefaultContext() *TestContext

DefaultContext returns a LambdaTestContext using a default AWS Lambda service.

func EmptyContext

func EmptyContext() *TestContext

EmptyContext returns a LambdaTestContext with no configured AWS service. It is suitable only for testing local function handlers.

func NewTestContext

func NewTestContext(svc LambdaAPI) *TestContext

NewLambdaFunctionContext creates a new HTTPTestContext for creating tests that target AWS Lambda functions using the provided AWS service.

func (*TestContext) Handle

func (c *TestContext) Handle(handlerFn interface{}, description ...string) *TestCase

func (*TestContext) Invoke

func (c *TestContext) Invoke(functionID string, description ...string) *TestCase

type TestResult

type TestResult struct {
	FunctionError   string
	InvocationError error
	LogBase64       string
	Payload         []byte
	Status          int
	Version         string
	// contains filtered or unexported fields
}

func (*TestResult) Errors

func (r *TestResult) Errors() []error

func (*TestResult) Log

func (r *TestResult) Log() (string, error)

func (*TestResult) TestCase

func (r *TestResult) TestCase() mt.TestCase

Jump to

Keyboard shortcuts

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