MCPcopy
hub / github.com/seaweedfs/seaweedfs / waitForHTTPServer

Function waitForHTTPServer

test/tus/tus_integration_test.go:200–212  ·  view source on GitHub ↗
(url string, timeout time.Duration)

Source from the content-addressed store, hash-verified

198}
199
200func waitForHTTPServer(url string, timeout time.Duration) error {
201 start := time.Now()
202 client := &http.Client{Timeout: 1 * time.Second}
203 for time.Since(start) < timeout {
204 resp, err := client.Get(url)
205 if err == nil {
206 resp.Body.Close()
207 return nil
208 }
209 time.Sleep(500 * time.Millisecond)
210 }
211 return fmt.Errorf("timeout waiting for %s", url)
212}
213
214// encodeTusMetadata encodes key-value pairs for Upload-Metadata header
215func encodeTusMetadata(metadata map[string]string) string {

Callers 1

startTestClusterFunction · 0.70

Calls 3

NowMethod · 0.80
GetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected