MCPcopy
hub / github.com/nats-io/nats.go / TestWSNoDeadlockOnAuthFailure

Function TestWSNoDeadlockOnAuthFailure

test/ws_test.go:596–614  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

594}
595
596func TestWSNoDeadlockOnAuthFailure(t *testing.T) {
597 o := testWSGetDefaultOptions(t, false)
598 o.Username = "user"
599 o.Password = "pwd"
600 s := RunServerWithOptions(o)
601 defer s.Shutdown()
602
603 tm := time.AfterFunc(3*time.Second, func() {
604 buf := make([]byte, 1000000)
605 n := runtime.Stack(buf, true)
606 panic(fmt.Sprintf("Test has probably deadlocked!\n%s\n", buf[:n]))
607 })
608
609 if _, err := nats.Connect(fmt.Sprintf("ws://127.0.0.1:%d", o.Websocket.Port)); err == nil {
610 t.Fatal("Expected auth error, did not get any error")
611 }
612
613 tm.Stop()
614}
615
616func TestWsWithCustomHeaders(t *testing.T) {
617 sopts := testWSGetDefaultOptions(t, false)

Callers

nothing calls this directly

Calls 4

testWSGetDefaultOptionsFunction · 0.85
ConnectMethod · 0.80
RunServerWithOptionsFunction · 0.70
StopMethod · 0.65

Tested by

no test coverage detected