(url string)
| 98 | } |
| 99 | |
| 100 | func callURL(url string) { |
| 101 | c := http.Client{ |
| 102 | Timeout: 10 * time.Millisecond, |
| 103 | } |
| 104 | res := make(chan interface{}, 1) |
| 105 | go func() { |
| 106 | for { |
| 107 | _, err := c.Get(url) |
| 108 | if err == nil { |
| 109 | res <- nil |
| 110 | } |
| 111 | } |
| 112 | }() |
| 113 | |
| 114 | select { |
| 115 | case <-res: |
| 116 | return |
| 117 | case <-time.After(5 * time.Second): |
| 118 | fmt.Printf("Timeout connecting to %s\n", url) |
| 119 | os.Exit(1) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | func TestMain(m *testing.M) { |
| 124 | d := &TestDriver{} |