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

Function testWSGetDefaultOptions

test/ws_test.go:38–59  ·  view source on GitHub ↗
(t *testing.T, tls bool)

Source from the content-addressed store, hash-verified

36)
37
38func testWSGetDefaultOptions(t *testing.T, tls bool) *server.Options {
39 t.Helper()
40 sopts := natsserver.DefaultTestOptions
41 sopts.Host = "127.0.0.1"
42 sopts.Port = -1
43 sopts.Websocket.Host = "127.0.0.1"
44 sopts.Websocket.Port = -1
45 sopts.Websocket.NoTLS = !tls
46 if tls {
47 tc := &server.TLSConfigOpts{
48 CertFile: "./configs/certs/server.pem",
49 KeyFile: "./configs/certs/key.pem",
50 CaFile: "./configs/certs/ca.pem",
51 }
52 tlsConfig, err := server.GenTLSConfig(tc)
53 if err != nil {
54 t.Fatalf("Can't build TLCConfig: %v", err)
55 }
56 sopts.Websocket.TLSConfig = tlsConfig
57 }
58 return &sopts
59}
60
61func TestWSBasic(t *testing.T) {
62 sopts := testWSGetDefaultOptions(t, false)

Callers 10

TestWSBasicFunction · 0.85
TestWSControlFramesFunction · 0.85
TestWSConcurrentConnsFunction · 0.85
TestWSCompressionFunction · 0.85
TestWSWithTLSFunction · 0.85
TestWSGossipAndReconnectFunction · 0.85
TestWSStressFunction · 0.85
TestWsWithCustomHeadersFunction · 0.85

Calls 1

FatalfMethod · 0.80

Tested by

no test coverage detected