(url string)
| 191 | } |
| 192 | |
| 193 | func callURL(url string) { |
| 194 | c := http.Client{ |
| 195 | Timeout: 10 * time.Millisecond, |
| 196 | } |
| 197 | res := make(chan interface{}, 1) |
| 198 | go func() { |
| 199 | for { |
| 200 | _, err := c.Get(url) |
| 201 | if err == nil { |
| 202 | res <- nil |
| 203 | } |
| 204 | } |
| 205 | }() |
| 206 | |
| 207 | select { |
| 208 | case <-res: |
| 209 | return |
| 210 | case <-time.After(5 * time.Second): |
| 211 | fmt.Printf("Timeout connecting to %s\n", url) |
| 212 | os.Exit(1) |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | func TestMain(m *testing.M) { |
| 217 | d := &TestPlugin{} |