MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestTickerEvery

Function TestTickerEvery

internal/utils/ticker_test.go:65–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func TestTickerEvery(t *testing.T) {
66 if !testutils.IsSingleTesting() {
67 return
68 }
69
70 i := 0
71 wg := &sync.WaitGroup{}
72 wg.Add(1)
73 Every(2*time.Second, func(ticker *Ticker) {
74 i++
75 t.Log("TestTickerEvery i:", i)
76 if i >= 4 {
77 ticker.Stop()
78 wg.Done()
79 }
80 })
81 wg.Wait()
82}
83
84func TestTicker_StopTwice(t *testing.T) {
85 if !testutils.IsSingleTesting() {

Callers

nothing calls this directly

Calls 7

IsSingleTestingFunction · 0.92
EveryFunction · 0.85
LogMethod · 0.80
DoneMethod · 0.80
AddMethod · 0.65
StopMethod · 0.65
WaitMethod · 0.45

Tested by

no test coverage detected