diff --git a/dynamodb/dynamodb_test.go b/dynamodb/dynamodb_test.go index 5e041e6f..fccf75cc 100644 --- a/dynamodb/dynamodb_test.go +++ b/dynamodb/dynamodb_test.go @@ -69,7 +69,11 @@ func Test_DynamoDB_SetWithContext(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() - err := testStore.SetWithContext(ctx, key, val, 0) + testStore, err := newTestStore(t) + require.NoError(t, err) + defer testStore.Close() + + err = testStore.SetWithContext(ctx, key, val, 0) require.ErrorIs(t, err, context.Canceled) } @@ -114,6 +118,10 @@ func Test_DynamoDB_GetWithContext(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() + testStore, err := newTestStore(t) + require.NoError(t, err) + defer testStore.Close() + result, err := testStore.GetWithContext(ctx, key) require.ErrorIs(t, err, context.Canceled) require.Zero(t, len(result)) @@ -154,7 +162,11 @@ func Test_DynamoDB_DeleteWithContext(t *testing.T) { val = []byte("doe") ) - err := testStore.Set(key, val, 0) + testStore, err := newTestStore(t) + require.NoError(t, err) + defer testStore.Close() + + err = testStore.Set(key, val, 0) require.NoError(t, err) ctx, cancel := context.WithCancel(context.Background()) @@ -195,7 +207,11 @@ func Test_DynamoDB_Reset(t *testing.T) { func Test_DynamoDB_ResetWithContext(t *testing.T) { val := []byte("doe") - err := testStore.Set("john1", val, 0) + testStore, err := newTestStore(t) + require.NoError(t, err) + defer testStore.Close() + + err = testStore.Set("john1", val, 0) require.NoError(t, err) err = testStore.Set("john2", val, 0)