fix the cache test
Showing
1 changed file
with
3 additions
and
1 deletions
| ... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
| 15 | package cache | 15 | package cache |
| 16 | 16 | ||
| 17 | import ( | 17 | import ( |
| 18 | "os" | ||
| 18 | "testing" | 19 | "testing" |
| 19 | "time" | 20 | "time" |
| 20 | ) | 21 | ) |
| ... | @@ -67,7 +68,7 @@ func TestCache(t *testing.T) { | ... | @@ -67,7 +68,7 @@ func TestCache(t *testing.T) { |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | func TestFileCache(t *testing.T) { | 70 | func TestFileCache(t *testing.T) { |
| 70 | bm, err := NewCache("file", `{"CachePath":"/cache","FileSuffix":".bin","DirectoryLevel":2,"EmbedExpiry":0}`) | 71 | bm, err := NewCache("file", `{"CachePath":"cache","FileSuffix":".bin","DirectoryLevel":2,"EmbedExpiry":0}`) |
| 71 | if err != nil { | 72 | if err != nil { |
| 72 | t.Error("init err") | 73 | t.Error("init err") |
| 73 | } | 74 | } |
| ... | @@ -112,4 +113,5 @@ func TestFileCache(t *testing.T) { | ... | @@ -112,4 +113,5 @@ func TestFileCache(t *testing.T) { |
| 112 | if v := bm.Get("astaxie"); v.(string) != "author" { | 113 | if v := bm.Get("astaxie"); v.(string) != "author" { |
| 113 | t.Error("get err") | 114 | t.Error("get err") |
| 114 | } | 115 | } |
| 116 | os.RemoveAll("cache") | ||
| 115 | } | 117 | } | ... | ... |
-
Please register or sign in to post a comment