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

Function TestGetSyncOne

src/pkg/store/store_test.go:228–247  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

226
227
228func TestGetSyncOne(t *testing.T) {
229 chV := make(chan []string)
230 chRev := make(chan int64)
231 st := New()
232 defer close(st.Ops)
233 go func() {
234 sync(st, 5)
235 v, rev := st.Get("/x")
236 chV <- v
237 chRev <- rev
238 }()
239 st.Ops <- Op{1, MustEncodeSet("/x", "a", Clobber)}
240 st.Ops <- Op{2, MustEncodeSet("/x", "a", Clobber)}
241 st.Ops <- Op{3, MustEncodeSet("/x", "a", Clobber)}
242 st.Ops <- Op{4, MustEncodeSet("/x", "a", Clobber)}
243 st.Ops <- Op{5, MustEncodeSet("/x", "b", Clobber)}
244 sync(st, 5)
245 assert.Equal(t, []string{"b"}, <-chV)
246 assert.Equal(t, int64(5), <-chRev)
247}
248
249func TestGetSyncSeveral(t *testing.T) {
250 chV := make(chan []string)

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
syncFunction · 0.85
MustEncodeSetFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected