From 1326aae5471ad0a0948a714ed06fc198ebea6129 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 3 Aug 2016 14:30:21 +0800 Subject: [PATCH] update storage testing. Signed-off-by: Bo-Yi Wu --- storage/boltdb/boltdb_test.go | 7 ++++++- storage/memory/memory_test.go | 5 +++++ storage/redis/redis_test.go | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/storage/boltdb/boltdb_test.go b/storage/boltdb/boltdb_test.go index cb24af8..265977b 100644 --- a/storage/boltdb/boltdb_test.go +++ b/storage/boltdb/boltdb_test.go @@ -6,7 +6,7 @@ import ( "testing" ) -func TestRedisEngine(t *testing.T) { +func TestBoltDBEngine(t *testing.T) { var val int64 config := c.BuildDefaultPushConf() @@ -37,4 +37,9 @@ func TestRedisEngine(t *testing.T) { boltDB.AddAndroidError(50) val = boltDB.GetAndroidError() assert.Equal(t, int64(50), val) + + // test reset db + boltDB.Reset() + val = boltDB.GetAndroidError() + assert.Equal(t, int64(0), val) } diff --git a/storage/memory/memory_test.go b/storage/memory/memory_test.go index 7957177..cf7800b 100644 --- a/storage/memory/memory_test.go +++ b/storage/memory/memory_test.go @@ -31,4 +31,9 @@ func TestMemoryEngine(t *testing.T) { memory.AddAndroidError(5) val = memory.GetAndroidError() assert.Equal(t, int64(5), val) + + // test reset db + memory.Reset() + val = memory.GetAndroidError() + assert.Equal(t, int64(0), val) } diff --git a/storage/redis/redis_test.go b/storage/redis/redis_test.go index 41a5149..e53b755 100644 --- a/storage/redis/redis_test.go +++ b/storage/redis/redis_test.go @@ -48,4 +48,9 @@ func TestRedisEngine(t *testing.T) { redis.AddAndroidError(50) val = redis.GetAndroidError() assert.Equal(t, int64(50), val) + + // test reset db + redis.Reset() + val = redis.GetAndroidError() + assert.Equal(t, int64(0), val) }