(t *testing.T)
| 337 | } |
| 338 | |
| 339 | func TestUserCredentialBytes(t *testing.T) { |
| 340 | ts := runTrustServer() |
| 341 | defer ts.Shutdown() |
| 342 | |
| 343 | // Test with JWT and seed as byte slices |
| 344 | jwtBytes := []byte(uJWT) |
| 345 | seedBytes := uSeed |
| 346 | |
| 347 | nc, err := nats.Connect(ts.ClientURL(), nats.UserCredentialBytes(jwtBytes, seedBytes)) |
| 348 | if err != nil { |
| 349 | t.Fatalf("Expected to connect with separate JWT and seed bytes, got %v", err) |
| 350 | } |
| 351 | nc.Close() |
| 352 | |
| 353 | // Test with chained credentials (JWT and seed in same byte slice) |
| 354 | nc2, err := nats.Connect(ts.ClientURL(), nats.UserCredentialBytes([]byte(chained))) |
| 355 | if err != nil { |
| 356 | t.Fatalf("Expected to connect with chained credentials bytes, got %v", err) |
| 357 | } |
| 358 | nc2.Close() |
| 359 | } |
| 360 | |
| 361 | // If we are using TLS and have multiple servers we try to match the IP |
| 362 | // from a discovered server with the expected hostname for certs without IP |
nothing calls this directly
no test coverage detected