(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestGetKvsInBatch(t *testing.T) { |
| 11 | tests := []struct { |
| 12 | name string |
| 13 | shards []uint64 |
| 14 | kvEntries uint64 |
| 15 | lastKvIdx uint64 |
| 16 | batchSize uint64 |
| 17 | batchStartIndex uint64 |
| 18 | expectedKvs []uint64 |
| 19 | expectedTotal uint64 |
| 20 | expectedBatchEnd uint64 |
| 21 | }{ |
| 22 | { |
| 23 | name: "1 shard batch 1", |
| 24 | shards: []uint64{0}, |
| 25 | kvEntries: 8, |
| 26 | lastKvIdx: 6, |
| 27 | batchSize: 5, |
| 28 | batchStartIndex: 0, |
| 29 | expectedKvs: []uint64{0, 1, 2, 3, 4}, |
| 30 | expectedTotal: 7, |
| 31 | expectedBatchEnd: 5, |
| 32 | }, |
| 33 | { |
| 34 | name: "1 shard batch 2", |
| 35 | shards: []uint64{0}, |
| 36 | kvEntries: 8, |
| 37 | lastKvIdx: 6, |
| 38 | batchSize: 5, |
| 39 | batchStartIndex: 5, |
| 40 | expectedKvs: []uint64{5, 6}, |
| 41 | expectedTotal: 7, |
| 42 | expectedBatchEnd: 7, |
| 43 | }, |
| 44 | { |
| 45 | name: "2 shards batch 1", |
| 46 | shards: []uint64{0, 1}, |
| 47 | kvEntries: 8, |
| 48 | lastKvIdx: 12, |
| 49 | batchSize: 5, |
| 50 | batchStartIndex: 0, |
| 51 | expectedKvs: []uint64{0, 1, 2, 3, 4}, |
| 52 | expectedTotal: 13, |
| 53 | expectedBatchEnd: 5, |
| 54 | }, |
| 55 | { |
| 56 | name: "2 shards batch 2", |
| 57 | shards: []uint64{0, 1}, |
| 58 | kvEntries: 8, |
| 59 | lastKvIdx: 12, |
| 60 | batchSize: 5, |
| 61 | batchStartIndex: 5, |
| 62 | expectedKvs: []uint64{5, 6, 7, 8, 9}, |
| 63 | expectedTotal: 13, |
| 64 | expectedBatchEnd: 10, |
| 65 | }, |
| 66 | { |
| 67 | name: "2 shards batch 3", |
nothing calls this directly
no test coverage detected