From e59271662cb815ad644e92a50c81ed38bdb7be8a Mon Sep 17 00:00:00 2001 From: JessonChan Date: Fri, 25 Mar 2016 13:25:29 +0800 Subject: [PATCH] fix bee fix --- cache/cache_test.go | 18 +++++++++--------- cache/memcache/memcache_test.go | 10 +++++----- cache/redis/redis_test.go | 10 +++++----- cache/ssdb/ssdb_test.go | 10 +++++----- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cache/cache_test.go b/cache/cache_test.go index ec344cb1..9ceb606a 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -25,8 +25,8 @@ func TestCache(t *testing.T) { if err != nil { t.Error("init err") } - timeoutDuration := 10 - if err = bm.Put("astaxie", 1, timeoutDuration*time.Second); err != nil { + timeoutDuration := 10 * time.Second + if err = bm.Put("astaxie", 1, timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie") { @@ -43,7 +43,7 @@ func TestCache(t *testing.T) { t.Error("check err") } - if err = bm.Put("astaxie", 1, timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie", 1, timeoutDuration); err != nil { t.Error("set Error", err) } @@ -68,7 +68,7 @@ func TestCache(t *testing.T) { } //test GetMulti - if err = bm.Put("astaxie", "author", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie", "author", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie") { @@ -78,7 +78,7 @@ func TestCache(t *testing.T) { t.Error("get err") } - if err = bm.Put("astaxie1", "author1", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie1", "author1", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie1") { @@ -102,8 +102,8 @@ func TestFileCache(t *testing.T) { if err != nil { t.Error("init err") } - timeoutDuration := 10 - if err = bm.Put("astaxie", 1, timeoutDuration*time.Second); err != nil { + timeoutDuration := 10 * time.Second + if err = bm.Put("astaxie", 1, timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie") { @@ -135,7 +135,7 @@ func TestFileCache(t *testing.T) { } //test string - if err = bm.Put("astaxie", "author", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie", "author", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie") { @@ -146,7 +146,7 @@ func TestFileCache(t *testing.T) { } //test GetMulti - if err = bm.Put("astaxie1", "author1", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie1", "author1", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie1") { diff --git a/cache/memcache/memcache_test.go b/cache/memcache/memcache_test.go index 9b9582f7..0c8c57f2 100644 --- a/cache/memcache/memcache_test.go +++ b/cache/memcache/memcache_test.go @@ -29,8 +29,8 @@ func TestMemcacheCache(t *testing.T) { if err != nil { t.Error("init err") } - timeoutDuration := 10 - if err = bm.Put("astaxie", "1", timeoutDuration*time.Second); err != nil { + timeoutDuration := 10 * time.Second + if err = bm.Put("astaxie", "1", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie") { @@ -42,7 +42,7 @@ func TestMemcacheCache(t *testing.T) { if bm.IsExist("astaxie") { t.Error("check err") } - if err = bm.Put("astaxie", "1", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie", "1", timeoutDuration); err != nil { t.Error("set Error", err) } @@ -71,7 +71,7 @@ func TestMemcacheCache(t *testing.T) { } //test string - if err = bm.Put("astaxie", "author", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie", "author", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie") { @@ -83,7 +83,7 @@ func TestMemcacheCache(t *testing.T) { } //test GetMulti - if err = bm.Put("astaxie1", "author1", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie1", "author1", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie1") { diff --git a/cache/redis/redis_test.go b/cache/redis/redis_test.go index 91efbb3e..6b81da4d 100644 --- a/cache/redis/redis_test.go +++ b/cache/redis/redis_test.go @@ -27,8 +27,8 @@ func TestRedisCache(t *testing.T) { if err != nil { t.Error("init err") } - timeoutDuration := 10 - if err = bm.Put("astaxie", 1, timeoutDuration*time.Second); err != nil { + timeoutDuration := 10 * time.Second + if err = bm.Put("astaxie", 1, timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie") { @@ -40,7 +40,7 @@ func TestRedisCache(t *testing.T) { if bm.IsExist("astaxie") { t.Error("check err") } - if err = bm.Put("astaxie", 1, timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie", 1, timeoutDuration); err != nil { t.Error("set Error", err) } @@ -69,7 +69,7 @@ func TestRedisCache(t *testing.T) { } //test string - if err = bm.Put("astaxie", "author", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie", "author", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie") { @@ -81,7 +81,7 @@ func TestRedisCache(t *testing.T) { } //test GetMulti - if err = bm.Put("astaxie1", "author1", timeoutDuration*time.Second); err != nil { + if err = bm.Put("astaxie1", "author1", timeoutDuration); err != nil { t.Error("set Error", err) } if !bm.IsExist("astaxie1") { diff --git a/cache/ssdb/ssdb_test.go b/cache/ssdb/ssdb_test.go index 4fea6fd8..dd474960 100644 --- a/cache/ssdb/ssdb_test.go +++ b/cache/ssdb/ssdb_test.go @@ -18,9 +18,9 @@ func TestSsdbcacheCache(t *testing.T) { if ssdb.IsExist("ssdb") { t.Error("check err") } - timeoutDuration := 10 + timeoutDuration := 10 * time.Second //timeoutDuration := -10*time.Second if timeoutDuration is negtive,it means permanent - if err = ssdb.Put("ssdb", "ssdb", timeoutDuration*time.Second); err != nil { + if err = ssdb.Put("ssdb", "ssdb", timeoutDuration); err != nil { t.Error("set Error", err) } if !ssdb.IsExist("ssdb") { @@ -28,7 +28,7 @@ func TestSsdbcacheCache(t *testing.T) { } // Get test done - if err = ssdb.Put("ssdb", "ssdb", timeoutDuration*time.Second); err != nil { + if err = ssdb.Put("ssdb", "ssdb", timeoutDuration); err != nil { t.Error("set Error", err) } @@ -37,7 +37,7 @@ func TestSsdbcacheCache(t *testing.T) { } //inc/dec test done - if err = ssdb.Put("ssdb", "2", timeoutDuration*time.Second); err != nil { + if err = ssdb.Put("ssdb", "2", timeoutDuration); err != nil { t.Error("set Error", err) } if err = ssdb.Incr("ssdb"); err != nil { @@ -53,7 +53,7 @@ func TestSsdbcacheCache(t *testing.T) { } // test del - if err = ssdb.Put("ssdb", "3", timeoutDuration*time.Second); err != nil { + if err = ssdb.Put("ssdb", "3", timeoutDuration); err != nil { t.Error("set Error", err) } if v, err := strconv.Atoi(ssdb.Get("ssdb").(string)); err != nil || v != 3 {