(t *testing.T)
| 291 | } |
| 292 | |
| 293 | func 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 | |
| 321 | func TestServer_ForwarderContinuesAfterError(t *testing.T) { |
| 322 | t.Parallel() |
nothing calls this directly
no test coverage detected