MCPcopy
hub / github.com/cubefs/cubefs / testDirectGetShard

Function testDirectGetShard

blobstore/blobnode/work_shard_recover_test.go:117–135  ·  view source on GitHub ↗
(t *testing.T, mode codemode.CodeMode)

Source from the content-addressed store, hash-verified

115}
116
117func testDirectGetShard(t *testing.T, mode codemode.CodeMode) {
118 repair, bidInfos, getter, replicas := InitMockRepair(mode)
119 badi := []uint8{0, 1}
120
121 failBids, err := repair.directGetShard(context.Background(), GetBids(bidInfos), badi)
122 require.NoError(t, err)
123 require.Equal(t, 0, len(failBids))
124 for _, bad := range badi {
125 vuid := replicas[bad].Vuid
126 for _, bid := range getter.getBids() {
127 data, err := repair.GetShard(bad, bid)
128 require.NoError(t, err)
129 crc1 := crc32.ChecksumIEEE(data)
130 crc2 := getter.getShardCrc32(vuid, bid)
131 require.Equal(t, crc2, crc1)
132 }
133 }
134 testCheckData(t, repair, getter, badi)
135}
136
137func TestRepairByLocalStripeAllMode(t *testing.T) {
138 testWithAllMode(t, testRepairByLocalStripe)

Callers

nothing calls this directly

Calls 8

InitMockRepairFunction · 0.85
GetBidsFunction · 0.85
testCheckDataFunction · 0.85
directGetShardMethod · 0.80
getBidsMethod · 0.80
getShardCrc32Method · 0.80
GetShardMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected