cacheinterface/memcache_test.go
Tyler 4af5b3af83
All checks were successful
continuous-integration/drone/push Build is passing
Remove server dependencies as Drone does not support services
2019-10-02 20:36:45 -04:00

36 lines
629 B
Go

package cache
import (
"testing"
)
func Test_MemcacheURI(t *testing.T) {
cache, err := New("memcache://localhost")
if err != nil {
t.Fatal("Error creating cache:", err)
}
if _, ok := cache.(*MemcacheCache); !ok {
t.Fatal("Cache is not instance of MemcacheCache")
}
}
func Test_MemcacheURIMultipleServers(t *testing.T) {
cache, err := New("memcache://localhost,localhost2")
if err != nil {
t.Fatal("Error creating cache:", err)
}
c, ok := cache.(*MemcacheCache)
if !ok {
t.Fatal("Cache is not instance of MemcacheCache")
}
if len(c.servers) != 2 {
t.Fatal("Number of servers does not match!")
}
}