MCPcopy
hub / github.com/etcd-io/etcd / TestSnapshot

Function TestSnapshot

contrib/raftexample/raftexample_test.go:260–286  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

258}
259
260func TestSnapshot(t *testing.T) {
261 prevDefaultSnapshotCount := defaultSnapshotCount
262 prevSnapshotCatchUpEntriesN := snapshotCatchUpEntriesN
263 defaultSnapshotCount = 4
264 snapshotCatchUpEntriesN = 4
265 defer func() {
266 defaultSnapshotCount = prevDefaultSnapshotCount
267 snapshotCatchUpEntriesN = prevSnapshotCatchUpEntriesN
268 }()
269
270 clus := newCluster(3)
271 defer clus.closeNoErrors(t)
272
273 go func() {
274 clus.proposeC[0] <- "foo"
275 }()
276
277 c := <-clus.commitC[0]
278
279 select {
280 case <-clus.snapshotTriggeredC[0]:
281 t.Fatalf("snapshot triggered before applying done")
282 default:
283 }
284 close(c.applyDoneC)
285 <-clus.snapshotTriggeredC[0]
286}

Callers

nothing calls this directly

Calls 3

closeNoErrorsMethod · 0.80
newClusterFunction · 0.70
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…