dynamodbtest

package
v0.0.0-...-f199800 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package dynamodbtest provides utilities for testing the DynamoDB persistence layer.

Index

Constants

View Source
const (
	IKCreated          = int64(1541461381)
	SKCreated          = int64(1541461380)
	EncryptedKeyString = "mWT/x4RvIFVFE2BEYV1IB9FMM8sWN1sK6YN5bS2UyGR+9RSZVTvp/bcQ6PycW6kxYEqrpA+aV4u04jOr"
	SKKeyID            = "_SK_api_ecomm"
	TestKey            = "some_key"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDynamoDBTestContext

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

func NewBaseContext

func NewBaseContext(t *testing.T, instant int64) *BaseDynamoDBTestContext

func (*BaseDynamoDBTestContext) Endpoint

func (d *BaseDynamoDBTestContext) Endpoint() string

Endpoint returns the endpoint for the DynamoDB instance.

type DynamoDBTestContext

type DynamoDBTestContext struct {
	BaseDynamoDBTestContext
	// contains filtered or unexported fields
}

func NewDynamoDBTestContext

func NewDynamoDBTestContext(t *testing.T, instant int64) *DynamoDBTestContext

NewDynamoDBTestContext creates a new DynamoDBTestContext.

If the DISABLE_TESTCONTAINERS environment variable is set to true, the test context will use the local DynamoDB instance. Otherwise, it will use a test container.

Use NewMetastore to create a new DynamoDBMetastore instance based on the context.

(Optionally) Use SeedDB to create the expected DynamoDB table and seed it with test data. It may be skipped if the table already exists, or if the table is not needed for the test.

Use CleanDB to clean the DynamoDB table as needed.

func (*DynamoDBTestContext) CleanDB

func (d *DynamoDBTestContext) CleanDB(t *testing.T)

CleanDB "cleans up" the DynamoDB table by deleting it.

This is useful for resetting table state in between test runs. Be sure to call SeedDB before running any additional tests that require the table to be populated.

func (*DynamoDBTestContext) InsertTestItem

func (d *DynamoDBTestContext) InsertTestItem(t *testing.T, instant int64)

func (*DynamoDBTestContext) NewMetastore

NewMetastore creates a new DynamoDBMetastore instance based on the context.

func (*DynamoDBTestContext) SeedDB

func (d *DynamoDBTestContext) SeedDB(t *testing.T)

SeedDB creates the DynamoDB table and seeds it with test data.

func (*DynamoDBTestContext) TearDown

func (d *DynamoDBTestContext) TearDown(t *testing.T)

type DynamoDBTestContextV2

type DynamoDBTestContextV2 struct {
	BaseDynamoDBTestContext
	// contains filtered or unexported fields
}

DynamoDBTestContextV2 provides AWS SDK v2 test utilities for DynamoDB integration testing.

func NewDynamoDBTestContextV2

func NewDynamoDBTestContextV2(t *testing.T, instant int64) *DynamoDBTestContextV2

NewDynamoDBTestContextV2 creates a new DynamoDBTestContextV2 with AWS SDK v2.

If the DISABLE_TESTCONTAINERS environment variable is set to true, the test context will use the local DynamoDB instance. Otherwise, it will use a test container.

Use NewMetastoreV2 to create a new DynamoDB metastore instance based on the context.

(Optionally) Use SeedDBV2 to create the expected DynamoDB table and seed it with test data. It may be skipped if the table already exists, or if the table is not needed for the test.

Use CleanDBV2 to clean the DynamoDB table as needed.

func (*DynamoDBTestContextV2) CleanDBV2

func (d *DynamoDBTestContextV2) CleanDBV2(t *testing.T)

CleanDBV2 "cleans up" the DynamoDB table by deleting it using AWS SDK v2.

This is useful for resetting table state in between test runs. Be sure to call SeedDBV2 before running any additional tests that require the table to be populated.

func (*DynamoDBTestContextV2) InsertTestItemV2

func (d *DynamoDBTestContextV2) InsertTestItemV2(t *testing.T, instant int64)

InsertTestItemV2 inserts a test item using AWS SDK v2.

func (*DynamoDBTestContextV2) NewMetastoreV2

func (d *DynamoDBTestContextV2) NewMetastoreV2(useRegionSuffix bool) *metastore.Metastore

NewMetastoreV2 creates a new plugins/aws-v2/dynamodb/metastore.Metastore instance based on the context.

func (*DynamoDBTestContextV2) SeedDBV2

func (d *DynamoDBTestContextV2) SeedDBV2(t *testing.T)

SeedDBV2 creates the DynamoDB table and seeds it with test data using AWS SDK v2.

func (*DynamoDBTestContextV2) TearDownV2

func (d *DynamoDBTestContextV2) TearDownV2(t *testing.T)

TearDownV2 performs cleanup for AWS SDK v2 test context.

Jump to

Keyboard shortcuts

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