MCPcopy
hub / github.com/grpc/grpc-go / TestHandshakeWithAccessToken

Method TestHandshakeWithAccessToken

credentials/alts/alts_test.go:339–356  ·  view source on GitHub ↗

TestHandshakeWithAccessToken performs an ALTS handshake between a test client and server, where both client and server offload to a local, fake handshaker service, and expects the StartClient request to include a bound access token.

(t *testing.T)

Source from the content-addressed store, hash-verified

337// server, where both client and server offload to a local, fake handshaker
338// service, and expects the StartClient request to include a bound access token.
339func (s) TestHandshakeWithAccessToken(t *testing.T) {
340 // Start the fake handshaker service and the server.
341 var wait sync.WaitGroup
342 defer wait.Wait()
343 boundAccessToken := "fake-bound-access-token"
344 stopHandshaker, handshakerAddress := startFakeHandshakerServiceWithExpectedBoundAccessToken(t, &wait, boundAccessToken)
345 defer stopHandshaker()
346 stopServer, serverAddress := startServer(t, handshakerAddress)
347 defer stopServer()
348
349 // Ping the server, authenticating with ALTS and a bound access token.
350 establishAltsConnectionWithBoundAccessToken(t, handshakerAddress, serverAddress, boundAccessToken)
351
352 // Close open connections to the fake handshaker service.
353 if err := service.CloseForTesting(); err != nil {
354 t.Errorf("service.CloseForTesting() failed: %v", err)
355 }
356}
357
358// TestConcurrentHandshakes performs a several, concurrent ALTS handshakes
359// between a test client and server, where both client and server offload to a

Callers

nothing calls this directly

Calls 6

CloseForTestingFunction · 0.92
WaitMethod · 0.80
startServerFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected