MCPcopy Index your code
hub / github.com/coder/coder / TestServer_MessageTooLarge

Function TestServer_MessageTooLarge

agent/boundarylogproxy/proxy_test.go:293–319  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

291}
292
293func TestServer_MessageTooLarge(t *testing.T) {
294 t.Parallel()
295
296 socketPath := filepath.Join(testutil.TempDirUnixSocket(t), "boundary.sock")
297 srv := boundarylogproxy.NewServer(testutil.Logger(t), socketPath, prometheus.NewRegistry())
298
299 err := srv.Start()
300 require.NoError(t, err)
301 t.Cleanup(func() { require.NoError(t, srv.Close()) })
302
303 conn, err := net.Dial("unix", socketPath)
304 require.NoError(t, err)
305 defer conn.Close()
306
307 // Send a message claiming to be larger than the max message size.
308 var length uint32 = codec.MaxMessageSizeV1 + 1
309 err = binary.Write(conn, binary.BigEndian, length)
310 require.NoError(t, err)
311
312 // The server should close the connection after receiving an oversized
313 // message length.
314 buf := make([]byte, 1)
315 err = conn.SetReadDeadline(time.Now().Add(time.Second))
316 require.NoError(t, err)
317 _, err = conn.Read(buf)
318 require.Error(t, err) // Should get EOF or closed connection.
319}
320
321func TestServer_ForwarderContinuesAfterError(t *testing.T) {
322 t.Parallel()

Callers

nothing calls this directly

Calls 13

StartMethod · 0.95
CloseMethod · 0.95
TempDirUnixSocketFunction · 0.92
NewServerFunction · 0.92
LoggerFunction · 0.92
SetReadDeadlineMethod · 0.80
CleanupMethod · 0.65
DialMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65
AddMethod · 0.65
ReadMethod · 0.65

Tested by

no test coverage detected