testutil

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAllInstances

func CloseAllInstances(ctx context.Context) error

CloseAllInstances stops and removes all tagged local instances.

func ListAllInstances

func ListAllInstances(ctx context.Context) ([]string, error)

ListAllInstances returns the names of all containers tagged as godynamodb-queue DynamoDB local.

Types

type DynamoDBLocal

type DynamoDBLocal struct {
	Name     string
	Port     int
	Image    string
	InMemory bool
	SharedDB bool
	// contains filtered or unexported fields
}

DynamoDBLocal controls a dockerized DynamoDB Local instance. It is intended for use in integration tests.

func NewLocalDynamoDB

func NewLocalDynamoDB(name string, opts ...LocalDynamoOption) *DynamoDBLocal

NewLocalDynamoDB creates a new, not-yet-started DynamoDBLocal runner.

func (*DynamoDBLocal) AWSConfig

func (d *DynamoDBLocal) AWSConfig() aws.Config

AWSConfig returns an AWS SDK config pointing at the local DynamoDB instance.

func (*DynamoDBLocal) Close

func (d *DynamoDBLocal) Close() error

Close removes the container (force).

func (*DynamoDBLocal) CreateTable

func (d *DynamoDBLocal) CreateTable(
	ctx context.Context,
	tableName string,
) error

CreateTable creates a DynamoDB table for the queue.

func (*DynamoDBLocal) DeleteTable

func (d *DynamoDBLocal) DeleteTable(ctx context.Context, tableName string) error

DeleteTable deletes a DynamoDB table.

func (*DynamoDBLocal) DynamoDBClient

func (d *DynamoDBLocal) DynamoDBClient(opts ...func(*dynamodb.Options)) *dynamodb.Client

DynamoDBClient returns a DynamoDB client configured to connect to the local instance.

func (*DynamoDBLocal) EndpointURL

func (d *DynamoDBLocal) EndpointURL() string

EndpointURL returns the HTTP endpoint URL for this local instance.

func (*DynamoDBLocal) Start

func (d *DynamoDBLocal) Start(ctx context.Context) error

Start launches the dockerized DynamoDB Local and waits for it to accept connections.

func (*DynamoDBLocal) Stop

func (d *DynamoDBLocal) Stop() error

Stop stops the container (but leaves it around because of --rm it will remove).

func (*DynamoDBLocal) WaitForReady

func (d *DynamoDBLocal) WaitForReady(ctx context.Context, timeout time.Duration) error

WaitForReady waits for DynamoDB Local to be ready to accept requests. It uses the ListTables API to verify the database is operational.

type LocalDynamoOption

type LocalDynamoOption func(*DynamoDBLocal)

LocalDynamoOption allows customizing the local DynamoDB runner.

func WithImage

func WithImage(img string) LocalDynamoOption

WithImage overrides the docker image (defaults to amazon/dynamodb-local:latest).

func WithInMemory

func WithInMemory(enabled bool) LocalDynamoOption

WithInMemory toggles the -inMemory flag.

func WithPort

func WithPort(port int) LocalDynamoOption

WithPort sets the host port to map to container.

func WithSharedDB

func WithSharedDB(enabled bool) LocalDynamoOption

WithSharedDB toggles the -sharedDb flag.

Jump to

Keyboard shortcuts

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