MCPcopy Create free account
hub / github.com/livekit/livekit / Start

Method Start

test/webhook_test.go:215–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

213}
214
215func (s *webhookTestServer) Start() error {
216 l, err := net.Listen("tcp", s.server.Addr)
217 if err != nil {
218 return err
219 }
220 go s.server.Serve(l)
221
222 // wait for webhook server to start
223 ctx, cancel := context.WithTimeout(context.Background(), testutils.ConnectTimeout)
224 defer cancel()
225 for {
226 select {
227 case <-ctx.Done():
228 return errors.New("could not start webhook server after timeout")
229 case <-time.After(10 * time.Millisecond):
230 // ensure we can connect to it
231 res, err := http.Get(fmt.Sprintf("http://localhost%s", s.server.Addr))
232 if err == nil && res.StatusCode == http.StatusOK {
233 return nil
234 }
235 }
236 }
237}
238
239func (s *webhookTestServer) Stop() {
240 _ = s.server.Shutdown(context.Background())

Callers

nothing calls this directly

Calls 2

DoneMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected