MCPcopy
hub / github.com/ha/doozerd / TestGcClean

Function TestGcClean

src/pkg/gc/clean_test.go:9–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestGcClean(t *testing.T) {
10 st := store.New()
11 defer close(st.Ops)
12
13 ticker := make(chan int64)
14 defer close(ticker)
15
16 go Clean(st, 3, ticker)
17
18 st.Ops <- store.Op{1, store.Nop}
19 st.Ops <- store.Op{2, store.Nop}
20 st.Ops <- store.Op{3, store.Nop}
21 st.Ops <- store.Op{4, store.Nop}
22
23 _, err := st.Wait(store.Any, 1)
24 assert.Equal(t, nil, err)
25 ticker <- 1
26 ticker <- 1 // Extra tick to ensure the last st.Clean has completed
27 _, err = st.Wait(store.Any, 1)
28 assert.Equal(t, store.ErrTooLate, err)
29}

Callers

nothing calls this directly

Calls 2

WaitMethod · 0.80
CleanFunction · 0.70

Tested by

no test coverage detected