MCPcopy
hub / github.com/cloudflare/tableflip / TestFdsConn

Function TestFdsConn

fds_test.go:267–293  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

265}
266
267func TestFdsConn(t *testing.T) {
268 socketPath, cleanup := tempSocket(t)
269 defer cleanup()
270 unix, err := net.ListenUnixgram("unixgram", &net.UnixAddr{
271 Net: "unixgram",
272 Name: socketPath,
273 })
274 if err != nil {
275 t.Fatal(err)
276 }
277
278 parent := newFds(nil, nil)
279 if err := parent.AddConn("unixgram", "", unix); err != nil {
280 t.Fatal("Can't add conn:", err)
281 }
282 unix.Close()
283
284 child := newFds(parent.copy(), nil)
285 conn, err := child.Conn("unixgram", "")
286 if err != nil {
287 t.Fatal("Can't get conn:", err)
288 }
289 if conn == nil {
290 t.Fatal("Missing conn")
291 }
292 conn.Close()
293}
294
295func TestFdsFile(t *testing.T) {
296 r, w, err := os.Pipe()

Callers

nothing calls this directly

Calls 5

tempSocketFunction · 0.85
newFdsFunction · 0.85
copyMethod · 0.80
AddConnMethod · 0.45
ConnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…