MCPcopy Index your code
hub / github.com/github/github-mcp-server / waitForToken

Function waitForToken

internal/oauth/testutil_test.go:205–216  ·  view source on GitHub ↗

waitForToken polls until the manager has a token or the deadline passes. The authorization-code flow completes asynchronously after the callback fires, so tests wait for the resulting token rather than sleeping a fixed duration.

(t *testing.T, m *Manager)

Source from the content-addressed store, hash-verified

203// authorization-code flow completes asynchronously after the callback fires, so
204// tests wait for the resulting token rather than sleeping a fixed duration.
205func waitForToken(t *testing.T, m *Manager) string {
206 t.Helper()
207 deadline := time.Now().Add(3 * time.Second)
208 for time.Now().Before(deadline) {
209 if tok := m.AccessToken(); tok != "" {
210 return tok
211 }
212 time.Sleep(5 * time.Millisecond)
213 }
214 t.Fatal("timed out waiting for access token")
215 return ""
216}

Calls 2

AddMethod · 0.80
AccessTokenMethod · 0.80

Tested by

no test coverage detected