MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestChunkQueue_Add_ChunkErrors

Function TestChunkQueue_Add_ChunkErrors

statesync/chunks_test.go:119–138  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

setupChunkQueueFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected