dynamodbtest

package
v0.0.0-...-3a15052 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 14 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 DynamoDBTestContext

type DynamoDBTestContext struct {
	// 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)

Jump to

Keyboard shortcuts

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