fix tests

This commit is contained in:
Muhammed Efe Cetin
2025-04-22 23:57:29 +03:00
parent 8dcdba4a72
commit ba32290665
11 changed files with 81 additions and 72 deletions

View File

@@ -75,11 +75,10 @@ func Test_MongoDB_SetWithContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
cancel()
testStore, err := newTestStore(t)
require.NoError(t, err)
testStore := newTestStore(t)
defer testStore.Close()
err = testStore.SetWithContext(ctx, key, val, 0)
err := testStore.SetWithContext(ctx, key, val, 0)
require.ErrorIs(t, err, context.Canceled)
}
@@ -122,11 +121,10 @@ func Test_MongoDB_GetWithContext(t *testing.T) {
val = []byte("doe")
)
testStore, err := newTestStore(t)
require.NoError(t, err)
testStore := newTestStore(t)
defer testStore.Close()
err = testStore.Set(key, val, 0)
err := testStore.Set(key, val, 0)
require.NoError(t, err)
ctx, cancel := context.WithCancel(context.Background())
@@ -203,11 +201,10 @@ func Test_MongoDB_DeleteWithContext(t *testing.T) {
val = []byte("doe")
)
testStore, err := newTestStore(t)
require.NoError(t, err)
testStore := newTestStore(t)
defer testStore.Close()
err = testStore.Set(key, val, 0)
err := testStore.Set(key, val, 0)
require.NoError(t, err)
ctx, cancel := context.WithCancel(context.Background())
@@ -248,11 +245,10 @@ func Test_MongoDB_Reset(t *testing.T) {
func Test_MongoDB_ResetWithContext(t *testing.T) {
val := []byte("doe")
testStore, err := newTestStore(t)
require.NoError(t, err)
testStore := newTestStore(t)
defer testStore.Close()
err = testStore.Set("john1", val, 0)
err := testStore.Set("john1", val, 0)
require.NoError(t, err)
err = testStore.Set("john2", val, 0)