diff --git a/postgres/postgres_test.go b/postgres/postgres_test.go index 55c79db5..1c8af87c 100644 --- a/postgres/postgres_test.go +++ b/postgres/postgres_test.go @@ -248,7 +248,11 @@ func Test_Postgres_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) } @@ -291,7 +295,11 @@ func Test_Postgres_GetWithContext(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()) @@ -368,7 +376,11 @@ func Test_Postgres_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()) @@ -405,7 +417,11 @@ func Test_Postgres_Reset(t *testing.T) { func Test_Postgres_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)