MCPcopy Index your code
hub / github.com/coder/coder / AssertNotClosed

Method AssertNotClosed

tailnet/test/peer.go:254–278  ·  view source on GitHub ↗
(d time.Duration)

Source from the content-addressed store, hash-verified

252}
253
254func (p *Peer) AssertNotClosed(d time.Duration) {
255 p.t.Helper()
256 // nolint: gocritic // erroneously thinks we're hardcoding non testutil constants here
257 ctx, cancel := context.WithTimeout(context.Background(), d)
258 defer cancel()
259 for {
260 select {
261 case <-ctx.Done():
262 // success!
263 return
264 case <-p.ctx.Done():
265 p.t.Error("main ctx timeout before elapsed time")
266 return
267 case resp, ok := <-p.resps:
268 if !ok {
269 p.t.Error("response channel closed")
270 return
271 }
272 err := p.handleResp(resp)
273 if !assert.NoError(p.t, err) {
274 return
275 }
276 }
277 }
278}
279
280func (p *Peer) AssertEventuallyReadyForHandshake(other uuid.UUID) {
281 p.t.Helper()

Callers 1

Calls 4

handleRespMethod · 0.95
HelperMethod · 0.65
DoneMethod · 0.45
ErrorMethod · 0.45

Tested by 1