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

Function TestSimplifiedURLs

nats_test.go:224–317  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

222}
223
224func TestSimplifiedURLs(t *testing.T) {
225 for _, test := range []struct {
226 name string
227 servers []string
228 expected []string
229 }{
230 {
231 "nats",
232 []string{
233 "nats://host1:1234/",
234 "nats://host1:1234",
235 "nats://host2:",
236 "nats://host3",
237 "host4:1234",
238 "host5:",
239 "host6",
240 "nats://[::1:2:3:4]:1234",
241 "nats://[::5:6:7:8]:",
242 "nats://[::9:10:11:12]",
243 "[::13:14:15:16]:",
244 "[::17:18:19:20]:1234",
245 },
246 []string{
247 "nats://host1:1234/",
248 "nats://host1:1234",
249 "nats://host2:4222",
250 "nats://host3:4222",
251 "nats://host4:1234",
252 "nats://host5:4222",
253 "nats://host6:4222",
254 "nats://[::1:2:3:4]:1234",
255 "nats://[::5:6:7:8]:4222",
256 "nats://[::9:10:11:12]:4222",
257 "nats://[::13:14:15:16]:4222",
258 "nats://[::17:18:19:20]:1234",
259 },
260 },
261 {
262 "ws",
263 []string{
264 "ws://host1:1234",
265 "ws://host2:",
266 "ws://host3",
267 "ws://[::1:2:3:4]:1234",
268 "ws://[::5:6:7:8]:",
269 "ws://[::9:10:11:12]",
270 },
271 []string{
272 "ws://host1:1234",
273 "ws://host2:80",
274 "ws://host3:80",
275 "ws://[::1:2:3:4]:1234",
276 "ws://[::5:6:7:8]:80",
277 "ws://[::9:10:11:12]:80",
278 },
279 },
280 {
281 "wss",

Callers

nothing calls this directly

Calls 4

setupServerPoolMethod · 0.95
GetDefaultOptionsFunction · 0.85
FatalfMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected