MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestWriteNoticeResponse

Function TestWriteNoticeResponse

server/protocol_test.go:416–433  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

414}
415
416func TestWriteNoticeResponse(t *testing.T) {
417 var buf bytes.Buffer
418
419 err := wire.WriteNoticeResponse(&buf, "WARNING", "01000", "some warning")
420 if err != nil {
421 t.Fatalf("wire.WriteNoticeResponse() error = %v", err)
422 }
423
424 // Message type should be 'N' (notice)
425 if buf.Bytes()[0] != 'N' {
426 t.Errorf("message type = %c, want N", buf.Bytes()[0])
427 }
428
429 data := buf.Bytes()[5:]
430 if !bytes.Contains(data, []byte("SWARNING")) {
431 t.Error("should contain severity WARNING")
432 }
433}
434
435func TestMessageRoundTrip(t *testing.T) {
436 // Test that we can write a message and read it back

Callers

nothing calls this directly

Calls 2

WriteNoticeResponseFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected