mirror of
https://github.com/gofiber/storage.git
synced 2025-10-05 08:37:10 +08:00
update tests
This commit is contained in:
@@ -21,6 +21,19 @@ func Test_Memcache_Set(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_Memcache_Set_Override(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_Memcache_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
|
@@ -21,6 +21,19 @@ func Test_Memory_Set(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_Memory_Set_Override(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_Memory_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
|
@@ -23,6 +23,19 @@ func Test_MongoDB_Set(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_MongoDB_Set_Override(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_MongoDB_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
|
@@ -27,6 +27,19 @@ func Test_MYSQL_Set(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_MYSQL_Set_Override(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_MYSQL_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
@@ -66,7 +79,6 @@ func Test_MYSQL_Get_Expired(t *testing.T) {
|
||||
|
||||
func Test_MYSQL_Get_NotExist(t *testing.T) {
|
||||
|
||||
|
||||
result, err := testStore.Get("notexist")
|
||||
utils.AssertEqual(t, ErrNotExist, err)
|
||||
utils.AssertEqual(t, true, len(result) == 0)
|
||||
|
@@ -27,6 +27,19 @@ func Test_Postgres_Set(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_Postgres_Set_Override(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_Postgres_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
|
@@ -23,6 +23,19 @@ func Test_Redis_Set(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_Redis_Set_Override(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_Redis_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
|
BIN
sqlite3/fiber.sqlite3
Normal file
BIN
sqlite3/fiber.sqlite3
Normal file
Binary file not shown.
@@ -24,6 +24,19 @@ func Test_SQLite3_Set(t *testing.T) {
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_SQLite3_Set_Override(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
val = []byte("doe")
|
||||
)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
|
||||
err := testStore.Set(key, val, 0)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
}
|
||||
|
||||
func Test_SQLite3_Get(t *testing.T) {
|
||||
var (
|
||||
key = "john"
|
||||
|
Reference in New Issue
Block a user