Skip to content

Commit

Permalink
fix: explicit add
Browse files Browse the repository at this point in the history
  • Loading branch information
maxneuvians authored Jan 20, 2024
1 parent 7a87c19 commit 1cf668e
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions storage/dynamodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ import (
"github.com/google/uuid"
)

func TestMain(m *testing.M) {
// Ensure that a DynamoDB table exists
backend := DynamoDBBackend{}

_ = backend.Init(map[string]string{
"endpoint": getDynamoDBHost(),
"region": "ca-central-1",
"table_name": "secrets",
})

_ = backend.createTable()

// setup
code := m.Run()
// teardown
os.Exit(code)
}

func getDynamoDBHost() string {
host := "http://dynamodb-local:8000"

Expand All @@ -47,6 +29,7 @@ func TestDynamoDBBackendDelete(t *testing.T) {
"table_name": "secrets",
})

_ = backend.createTable()
err := backend.Delete(uuid.New())

if err != nil {
Expand Down Expand Up @@ -104,7 +87,7 @@ func TestDynamoDBBackendInitWithEndpoint(t *testing.T) {

err := backend.Init(map[string]string{
"region": "ca-central-1",
"table_name": "s",
"table_name": "secrets",
"endpoint": getDynamoDBHost(),
})

Expand All @@ -123,6 +106,7 @@ func TestDynamoDBBackendStore(t *testing.T) {
"region": "ca-central-1",
"table_name": "secrets",
})
_ = backend.createTable()

id, err := backend.Store([]byte("test"), []byte("test"), 1000)

Expand All @@ -145,6 +129,7 @@ func TestDynamoDBBackendRetrieveWithTTLInFuture(t *testing.T) {
"region": "ca-central-1",
"table_name": "secrets",
})
_ = backend.createTable()

id, err := backend.Store([]byte("test"), []byte("key"), time.Now().Add(time.Hour).Unix())

Expand Down Expand Up @@ -177,6 +162,7 @@ func TestDynamoDBBackendRetrieveWithTTLInPast(t *testing.T) {
"region": "ca-central-1",
"table_name": "secrets",
})
_ = backend.createTable()

id, err := backend.Store([]byte("test"), []byte("key"), time.Now().Add(-time.Hour).Unix())

Expand Down

0 comments on commit 1cf668e

Please sign in to comment.