MCPcopy Create free account
hub / github.com/tendermint/tendermint / TestChunkQueue_Add_ChunkErrors

Function TestChunkQueue_Add_ChunkErrors

internal/statesync/chunks_test.go:120–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118}
119
120func TestChunkQueue_Add_ChunkErrors(t *testing.T) {
121 testcases := map[string]struct {
122 chunk *chunk
123 }{
124 "nil chunk": {nil},
125 "nil body": {&chunk{Height: 3, Format: 1, Index: 0, Chunk: nil}},
126 "wrong height": {&chunk{Height: 9, Format: 1, Index: 0, Chunk: []byte{3, 1, 0}}},
127 "wrong format": {&chunk{Height: 3, Format: 9, Index: 0, Chunk: []byte{3, 1, 0}}},
128 "invalid index": {&chunk{Height: 3, Format: 1, Index: 5, Chunk: []byte{3, 1, 0}}},
129 }
130 for name, tc := range testcases {
131 tc := tc
132 t.Run(name, func(t *testing.T) {
133 queue, teardown := setupChunkQueue(t)
134 defer teardown()
135 _, err := queue.Add(tc.chunk)
136 require.Error(t, err)
137 })
138 }
139}
140
141func TestChunkQueue_Allocate(t *testing.T) {
142 queue, teardown := setupChunkQueue(t)

Callers

nothing calls this directly

Calls 5

setupChunkQueueFunction · 0.85
teardownFunction · 0.85
RunMethod · 0.65
AddMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…