MCPcopy Create free account
hub / github.com/dc0d/workerpool / TestAbsoluteTimeout

Function TestAbsoluteTimeout

workerpool_usage_test.go:62–83  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestAbsoluteTimeout(t *testing.T) {
63 initialWorkers := 1
64 extraWorkers := 10
65
66 pool := workerpool.New(initialWorkers, 2)
67
68 quit1 := make(chan struct{})
69 pool.Expand(extraWorkers, 0, quit1)
70
71 done := make(chan bool)
72 absoluteTimeout := func() {
73 defer close(done)
74 <-time.After(time.Millisecond * 100)
75 close(quit1)
76 }
77
78 go absoluteTimeout()
79 <-done
80 <-time.After(time.Millisecond * 400)
81
82 assert.NoError(t, waitFunc(pool.Stop, _timeout))
83}
84
85func TestTimeout(t *testing.T) {
86 initialWorkers := 1

Callers

nothing calls this directly

Calls 2

waitFuncFunction · 0.85
ExpandMethod · 0.80

Tested by

no test coverage detected