(t *testing.T, tls bool)
| 36 | ) |
| 37 | |
| 38 | func 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 | |
| 61 | func TestWSBasic(t *testing.T) { |
| 62 | sopts := testWSGetDefaultOptions(t, false) |
no test coverage detected