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

Function TestUseDefaultTimeout

test/conn_test.go:1717–1732  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1715}
1716
1717func TestUseDefaultTimeout(t *testing.T) {
1718 s := RunDefaultServer()
1719 defer s.Shutdown()
1720
1721 opts := &nats.Options{
1722 Servers: []string{nats.DefaultURL},
1723 }
1724 nc, err := opts.Connect()
1725 if err != nil {
1726 t.Fatalf("Unexpected error on connect: %v", err)
1727 }
1728 defer nc.Close()
1729 if nc.Opts.Timeout != nats.DefaultTimeout {
1730 t.Fatalf("Expected Timeout to be set to %v, got %v", nats.DefaultTimeout, nc.Opts.Timeout)
1731 }
1732}
1733
1734func TestLastErrorNoRace(t *testing.T) {
1735 s := RunDefaultServer()

Callers

nothing calls this directly

Calls 4

ConnectMethod · 0.95
FatalfMethod · 0.80
RunDefaultServerFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected