MCPcopy
hub / github.com/bradfitz/gomemcache / TestUnixSocket

Function TestUnixSocket

memcache/memcache_test.go:56–76  ·  view source on GitHub ↗

Run the memcached binary as a child process and connect to its unix socket.

(t *testing.T)

Source from the content-addressed store, hash-verified

54
55// Run the memcached binary as a child process and connect to its unix socket.
56func TestUnixSocket(t *testing.T) {
57 t.Parallel()
58 sock := fmt.Sprintf("/tmp/test-gomemcache-%d.sock", os.Getpid())
59 cmd := exec.Command("memcached", "-s", sock)
60 if err := cmd.Start(); err != nil {
61 t.Skipf("skipping test; couldn't find memcached")
62 return
63 }
64 defer cmd.Wait()
65 defer cmd.Process.Kill()
66
67 // Wait a bit for the socket to appear.
68 for i := 0; i < 10; i++ {
69 if _, err := os.Stat(sock); err == nil {
70 break
71 }
72 time.Sleep(time.Duration(25*i) * time.Millisecond)
73 }
74
75 testWithClient(t, New(sock))
76}
77
78func TestFakeServer(t *testing.T) {
79 t.Parallel()

Callers

nothing calls this directly

Calls 2

testWithClientFunction · 0.85
NewFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…