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

Function TestDoozerWaitWithRev

src/pkg/peer/peer_test.go:145–171  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

143
144
145func TestDoozerWaitWithRev(t *testing.T) {
146 l := mustListen()
147 defer l.Close()
148 u := mustListenUDP(l.Addr().String())
149 defer u.Close()
150
151 go Main("a", "X", "", "", "", nil, u, l, nil, 1e9, 2e9, 3e9, 101)
152
153 cl := dial(l.Addr().String())
154
155 // Create some history
156 cl.Set("/test/foo", store.Clobber, []byte("bar"))
157 cl.Set("/test/fun", store.Clobber, []byte("house"))
158
159 ev, err := cl.Wait("/test/**", 1)
160 assert.Equal(t, nil, err)
161 assert.Equal(t, "/test/foo", ev.Path)
162 assert.Equal(t, []byte("bar"), ev.Body)
163 assert.T(t, ev.IsSet())
164 rev := ev.Rev + 1
165
166 ev, err = cl.Wait("/test/**", rev)
167 assert.Equal(t, nil, err)
168 assert.Equal(t, "/test/fun", ev.Path)
169 assert.Equal(t, []byte("house"), ev.Body)
170 assert.T(t, ev.IsSet())
171}
172
173
174func TestDoozerStat(t *testing.T) {

Callers

nothing calls this directly

Calls 8

mustListenFunction · 0.85
mustListenUDPFunction · 0.85
MainFunction · 0.85
dialFunction · 0.85
SetMethod · 0.80
WaitMethod · 0.80
IsSetMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected