chore: use testcontainers properly in mysql

This commit is contained in:
Manuel de la Peña
2025-03-28 13:06:34 +01:00
committed by Muhammed Efe Cetin
parent f3bdd2599c
commit d1893c2e4a

View File

@@ -99,7 +99,11 @@ func Test_MYSQL_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)
}
@@ -142,7 +146,11 @@ func Test_MYSQL_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())
@@ -219,7 +227,11 @@ func Test_MYSQL_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())
@@ -260,7 +272,11 @@ func Test_MYSQL_Reset(t *testing.T) {
func Test_MYSQL_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)