MCPcopy
hub / github.com/tuna/tunasync / startWorkerThenStop

Function startWorkerThenStop

worker/worker_test.go:52–71  ·  view source on GitHub ↗
(cfg *Config, tester workTestFunc)

Source from the content-addressed store, hash-verified

50}
51
52func 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}
72func sendCommandToWorker(workerURL string, httpClient *http.Client, cmd CmdVerb, mirror string) {
73 workerCmd := WorkerCmd{
74 Cmd: cmd,

Callers 1

TestWorkerFunction · 0.85

Calls 3

NewTUNASyncWorkerFunction · 0.85
HaltMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected