Documentation ¶
Overview ¶
Package dynamodbtest provides utilities for testing the DynamoDB persistence layer.
Index ¶
- Constants
- type BaseDynamoDBTestContext
- type DynamoDBTestContext
- func (d *DynamoDBTestContext) CleanDB(t *testing.T)
- func (d *DynamoDBTestContext) InsertTestItem(t *testing.T, instant int64)
- func (d *DynamoDBTestContext) NewMetastore(opts ...persistence.DynamoDBMetastoreOption) *persistence.DynamoDBMetastore
- func (d *DynamoDBTestContext) NewMetastoreV2(useRegionSuffix bool) *metastore.Metastore
- func (d *DynamoDBTestContext) SeedDB(t *testing.T)
- func (d *DynamoDBTestContext) TearDown(t *testing.T)
Constants ¶
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 ¶
func (d *DynamoDBTestContext) NewMetastore(opts ...persistence.DynamoDBMetastoreOption) *persistence.DynamoDBMetastore
NewMetastore creates a new DynamoDBMetastore instance based on the context.
func (*DynamoDBTestContext) NewMetastoreV2 ¶
func (d *DynamoDBTestContext) NewMetastoreV2(useRegionSuffix bool) *metastore.Metastore
NewMetastore creates a new plugins/aws-v2/dynamodb/metastore.Metastore 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)