(cfg *Config, tester workTestFunc)
| 50 | } |
| 51 | |
| 52 | func startWorkerThenStop(cfg *Config, tester workTestFunc) { |
| 53 | exitedChan := make(chan int) |
| 54 | w := NewTUNASyncWorker(cfg) |
| 55 | So(w, ShouldNotBeNil) |
| 56 | go func() { |
| 57 | w.Run() |
| 58 | exitedChan <- 1 |
| 59 | }() |
| 60 | |
| 61 | tester(w) |
| 62 | |
| 63 | w.Halt() |
| 64 | select { |
| 65 | case exited := <-exitedChan: |
| 66 | So(exited, ShouldEqual, 1) |
| 67 | case <-time.After(2 * time.Second): |
| 68 | So(0, ShouldEqual, 1) |
| 69 | } |
| 70 | |
| 71 | } |
| 72 | func sendCommandToWorker(workerURL string, httpClient *http.Client, cmd CmdVerb, mirror string) { |
| 73 | workerCmd := WorkerCmd{ |
| 74 | Cmd: cmd, |
no test coverage detected