(errChan <-chan error)
| 73 | } |
| 74 | |
| 75 | func (s *TestingServer) waitForServerStart(errChan <-chan error) error { |
| 76 | ticker := time.NewTicker(100 * time.Millisecond) |
| 77 | defer ticker.Stop() |
| 78 | |
| 79 | for { |
| 80 | select { |
| 81 | case <-ticker.C: |
| 82 | if s == nil { |
| 83 | continue |
| 84 | } |
| 85 | e := s.server.GetEcho() |
| 86 | if e == nil { |
| 87 | continue |
| 88 | } |
| 89 | addr := e.ListenerAddr() |
| 90 | if addr != nil && strings.Contains(addr.String(), ":") { |
| 91 | return nil // was started |
| 92 | } |
| 93 | case err := <-errChan: |
| 94 | if err == http.ErrServerClosed { |
| 95 | return nil |
| 96 | } |
| 97 | return err |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func (s *TestingServer) request(method, uri string, body io.Reader, params, header map[string]string) (io.ReadCloser, error) { |
| 103 | fullURL := fmt.Sprintf("http://localhost:%d%s", s.profile.Port, uri) |
no test coverage detected