From 79f1f1609e010eaaf67547e0a72a7e954a2a54d6 Mon Sep 17 00:00:00 2001 From: Fenny <25108519+Fenny@users.noreply.github.com> Date: Thu, 5 Nov 2020 05:57:14 +0100 Subject: [PATCH] update tests --- memcache/memcache_test.go | 13 +++++++++++++ memory/memory_test.go | 13 +++++++++++++ mongodb/mongodb_test.go | 13 +++++++++++++ mysql/mysql_test.go | 14 +++++++++++++- postgres/postgres_test.go | 13 +++++++++++++ redis/redis_test.go | 13 +++++++++++++ sqlite3/fiber.sqlite3 | Bin 0 -> 16384 bytes sqlite3/sqlite3_test.go | 13 +++++++++++++ 8 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 sqlite3/fiber.sqlite3 diff --git a/memcache/memcache_test.go b/memcache/memcache_test.go index a3100896..82d262f6 100644 --- a/memcache/memcache_test.go +++ b/memcache/memcache_test.go @@ -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" diff --git a/memory/memory_test.go b/memory/memory_test.go index 2adb1fcc..a71bc531 100644 --- a/memory/memory_test.go +++ b/memory/memory_test.go @@ -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" diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index b2f2395f..741911e7 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -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" diff --git a/mysql/mysql_test.go b/mysql/mysql_test.go index 4958e909..d3c5c872 100644 --- a/mysql/mysql_test.go +++ b/mysql/mysql_test.go @@ -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) diff --git a/postgres/postgres_test.go b/postgres/postgres_test.go index 9b2064b3..99940446 100644 --- a/postgres/postgres_test.go +++ b/postgres/postgres_test.go @@ -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" diff --git a/redis/redis_test.go b/redis/redis_test.go index 92e34300..2fbb6235 100644 --- a/redis/redis_test.go +++ b/redis/redis_test.go @@ -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" diff --git a/sqlite3/fiber.sqlite3 b/sqlite3/fiber.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..49f130baef8e7bf16a34c7f78563eb8e0cc774cb GIT binary patch literal 16384 zcmeI%O)tbi7zgl~&W3h_O7_s}bE{1dix4-pTWnNOCB$J<*vuo8s;<(9wlIhITd1f;6yG^^h<22%sPNLRT5YrqRXPmQTBF0!=)|{-pqR7tA znD++$X!C4(?QvB9U}Ef<=|X>!4GIJx009U<00Izz00bZa0SG|gp8{nuWE4z()M(bj zPT09VX&i^GT04$f!D*N)d$#4* zN|{hdXf?qeO&;Tn>2LZ=(nWy)1Rwwb2tWV=5P$##AOHafKwvNhMwFaUP|u^Y=4?F* zM|dwP$td~BpWgr9_1D2X9d-=?2tWV=5P$##AOHafKmY;|fIvn-69!K|11PF6w4_)1 pzW;yf@0nZ#5P$##AOHafKmY;|fB*y_009ULx