MCPcopy Create free account
hub / github.com/CPChain/chain / verifyImportEvent

Function verifyImportEvent

protocols/cpc/fetcher/fetcher_test.go:225–239  ·  view source on GitHub ↗

verifyImportEvent verifies that one single event arrive on an import channel.

(t *testing.T, imported chan *types.Block, arrive bool)

Source from the content-addressed store, hash-verified

223
224// verifyImportEvent verifies that one single event arrive on an import channel.
225func verifyImportEvent(t *testing.T, imported chan *types.Block, arrive bool) {
226 if arrive {
227 select {
228 case <-imported:
229 case <-time.After(time.Second):
230 t.Fatalf("import timeout")
231 }
232 } else {
233 select {
234 case <-imported:
235 t.Fatalf("import invoked")
236 case <-time.After(10 * time.Millisecond):
237 }
238 }
239}
240
241// verifyImportCount verifies that exactly count number of events arrive on an
242// import hook channel.

Calls

no outgoing calls

Tested by

no test coverage detected