(addrChan <-chan string, errCh <-chan error)
| 43 | } |
| 44 | |
| 45 | func waitForServerStart(addrChan <-chan string, errCh <-chan error) (string, error) { |
| 46 | waitCtx, cancel := stdContext.WithTimeout(stdContext.Background(), 200*time.Millisecond) |
| 47 | defer cancel() |
| 48 | |
| 49 | // wait for addr to arrive |
| 50 | for { |
| 51 | select { |
| 52 | case <-waitCtx.Done(): |
| 53 | return "", waitCtx.Err() |
| 54 | case addr := <-addrChan: |
| 55 | return addr, nil |
| 56 | case err := <-errCh: |
| 57 | if err == http.ErrServerClosed { // was closed normally before listener callback was called. should not be possible |
| 58 | return "", nil |
| 59 | } |
| 60 | // failed to start and we did not manage to get even listener part. |
| 61 | return "", err |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func doGet(url string) (int, string, error) { |
| 67 | resp, err := http.Get(url) |
no outgoing calls
no test coverage detected
searching dependent graphs…