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

Function TestCloseProposerInflight

contrib/raftexample/raftexample_test.go:153–173  ·  view source on GitHub ↗

TestCloseProposerInflight tests closing the producer while committed messages are being published to the client.

(t *testing.T)

Source from the content-addressed store, hash-verified

151// TestCloseProposerInflight tests closing the producer while
152// committed messages are being published to the client.
153func TestCloseProposerInflight(t *testing.T) {
154 clus := newCluster(1)
155 defer clus.closeNoErrors(t)
156
157 var wg sync.WaitGroup
158 wg.Add(1)
159
160 // some inflight ops
161 go func() {
162 defer wg.Done()
163 clus.proposeC[0] <- "foo"
164 clus.proposeC[0] <- "bar"
165 }()
166
167 // wait for one message
168 if c, ok := <-clus.commitC[0]; !ok || c.data[0] != "foo" {
169 t.Fatalf("Commit failed")
170 }
171
172 wg.Wait()
173}
174
175func TestPutAndGetKeyValue(t *testing.T) {
176 clusters := []string{"http://127.0.0.1:9021"}

Callers

nothing calls this directly

Calls 6

closeNoErrorsMethod · 0.80
newClusterFunction · 0.70
AddMethod · 0.65
DoneMethod · 0.65
FatalfMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…