MCPcopy Create free account
hub / github.com/github/copilot-sdk / WaitForExchanges

Method WaitForExchanges

go/internal/e2e/testharness/context.go:180–201  ·  view source on GitHub ↗

WaitForExchanges waits until the proxy has captured at least the requested exchanges.

(t *testing.T, minimumCount int)

Source from the content-addressed store, hash-verified

178
179// WaitForExchanges waits until the proxy has captured at least the requested exchanges.
180func (c *TestContext) WaitForExchanges(t *testing.T, minimumCount int) []ParsedHttpExchange {
181 t.Helper()
182
183 deadline := time.Now().Add(120 * time.Second)
184 var lastErr error
185 var exchanges []ParsedHttpExchange
186 for time.Now().Before(deadline) {
187 var err error
188 exchanges, err = c.GetExchanges()
189 if err == nil && len(exchanges) >= minimumCount {
190 return exchanges
191 }
192 lastErr = err
193 time.Sleep(100 * time.Millisecond)
194 }
195
196 if lastErr != nil {
197 t.Fatalf("Timed out waiting for %d chat completion request(s): %v", minimumCount, lastErr)
198 }
199 t.Fatalf("Timed out waiting for %d chat completion request(s); captured %d", minimumCount, len(exchanges))
200 return nil
201}
202
203// SetCopilotUserByToken registers a per-token user configuration on the proxy.
204func (c *TestContext) SetCopilotUserByToken(token string, response map[string]interface{}) error {

Callers 4

TestModeEmptyE2EFunction · 0.95
TestSessionE2EFunction · 0.95
sendAndGetNextExchangeFunction · 0.80

Calls 2

GetExchangesMethod · 0.95
AddMethod · 0.45

Tested by 4

TestModeEmptyE2EFunction · 0.76
TestSessionE2EFunction · 0.76
sendAndGetNextExchangeFunction · 0.64