MCPcopy Create free account
hub / github.com/encodeous/nylon / TestIPCSocketResponseHasNoUAPIErrnoTrailer

Function TestIPCSocketResponseHasNoUAPIErrnoTrailer

integration/ipc_test.go:215–255  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

213}
214
215func TestIPCSocketResponseHasNoUAPIErrnoTrailer(t *testing.T) {
216 defer goleak.VerifyNone(t)
217 vh, errs := setupTwoNodeHarness(t)
218 defer vh.Stop()
219
220 time.Sleep(1 * time.Second)
221
222 a := vh.Nylons[vh.IndexOf("a")].Load()
223 client, server := net.Pipe()
224 defer client.Close()
225 go a.Device.IpcHandle(server)
226
227 m := protojson.MarshalOptions{EmitUnpopulated: true}
228 data, err := m.Marshal(&protocol.IpcRequest{
229 Request: &protocol.IpcRequest_Status{Status: &protocol.StatusRequest{}},
230 })
231 require.NoError(t, err)
232
233 _, err = client.Write(append(append([]byte("get=nylon\n"), data...), '\n'))
234 require.NoError(t, err)
235
236 reader := bufio.NewReader(client)
237 line, err := reader.ReadBytes('\n')
238 require.NoError(t, err)
239
240 resp := &protocol.IpcResponse{}
241 um := protojson.UnmarshalOptions{DiscardUnknown: true}
242 require.NoError(t, um.Unmarshal(line, resp))
243 require.True(t, resp.Ok)
244
245 require.NoError(t, client.SetReadDeadline(time.Now().Add(100*time.Millisecond)))
246 extra, err := reader.ReadString('\n')
247 require.Error(t, err)
248 require.NotContains(t, extra, "errno=")
249
250 select {
251 case err := <-errs:
252 t.Fatal(err)
253 default:
254 }
255}

Callers

nothing calls this directly

Calls 8

setupTwoNodeHarnessFunction · 0.85
IndexOfMethod · 0.80
IpcHandleMethod · 0.80
StopMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65
SetReadDeadlineMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected