MCPcopy
hub / github.com/livekit/livekit / waitForServerToStart

Function waitForServerToStart

test/integration_helpers.go:114–132  ·  view source on GitHub ↗
(s *service.LivekitServer)

Source from the content-addressed store, hash-verified

112}
113
114func waitForServerToStart(s *service.LivekitServer) {
115 // wait till ready
116 ctx, cancel := context.WithTimeout(context.Background(), testutils.ConnectTimeout)
117 defer cancel()
118 for {
119 select {
120 case <-ctx.Done():
121 panic("could not start server after timeout")
122 case <-time.After(10 * time.Millisecond):
123 if s.IsRunning() {
124 // ensure we can connect to it
125 res, err := http.Get(fmt.Sprintf("http://localhost:%d", s.HTTPPort()))
126 if err == nil && res.StatusCode == http.StatusOK {
127 return
128 }
129 }
130 }
131 }
132}
133
134func waitUntilConnected(t *testing.T, clients ...*testclient.RTCClient) {
135 logger.Infow("waiting for clients to become connected")

Callers 8

setupSingleNodeTestFunction · 0.85
setupServerWithWebhookFunction · 0.85
TestAutoCreateFunction · 0.85
TestTurnRelayFunction · 0.85
TestTurnAuthFailureFunction · 0.85
setupDataBlobServerFunction · 0.85

Calls 4

DoneMethod · 0.80
HTTPPortMethod · 0.80
IsRunningMethod · 0.45
GetMethod · 0.45

Tested by 6

setupServerWithWebhookFunction · 0.68
TestAutoCreateFunction · 0.68
TestTurnRelayFunction · 0.68
TestTurnAuthFailureFunction · 0.68
setupDataBlobServerFunction · 0.68