github.com/msales/pkg/v3@v3.24.0/cache/memcache_test.go (about) 1 package cache_test 2 3 import ( 4 "net" 5 "testing" 6 7 "github.com/msales/pkg/v3/cache" 8 ) 9 10 var ( 11 testMemcachedServer = "localhost:11211" 12 skipMemcache = false 13 ) 14 15 func init() { 16 c, err := net.Dial("tcp", testMemcachedServer) 17 if err != nil { 18 skipMemcache = true 19 return 20 } 21 c.Write([]byte("flush_all\r\n")) 22 c.Close() 23 } 24 25 func TestMemcacheCache(t *testing.T) { 26 if skipMemcache { 27 t.Skipf("skipping test; no running server at %s", testMemcachedServer) 28 } 29 30 c := cache.NewMemcache(testMemcachedServer) 31 runCacheTests(t, c) 32 }