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

Function TestUserCredentialsTwoFiles

test/nats_test.go:243–261  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

241}
242
243func TestUserCredentialsTwoFiles(t *testing.T) {
244 if server.VERSION[0] == '1' {
245 t.Skip()
246 }
247 ts := runTrustServer()
248 defer ts.Shutdown()
249
250 userJWTFile := createTmpFile(t, []byte(uJWT))
251 defer os.Remove(userJWTFile)
252 userSeedFile := createTmpFile(t, uSeed)
253 defer os.Remove(userSeedFile)
254
255 url := fmt.Sprintf("nats://127.0.0.1:%d", TEST_PORT)
256 nc, err := nats.Connect(url, nats.UserCredentials(userJWTFile, userSeedFile))
257 if err != nil {
258 t.Fatalf("Expected to connect, got %v", err)
259 }
260 nc.Close()
261}
262
263func TestUserCredentialsChainedFile(t *testing.T) {
264 if server.VERSION[0] == '1' {

Callers

nothing calls this directly

Calls 5

runTrustServerFunction · 0.85
ConnectMethod · 0.80
FatalfMethod · 0.80
createTmpFileFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected