satellite/repair: update repair test to use blake3 algo

Update repair test to also use blake3 hashing algorithm
https://github.com/storj/storj/issues/5649

Change-Id: Id8299576f8be4cfd84ddf9a6b852e653628ada72
This commit is contained in:
igor gaidaienko 2023-05-10 12:23:38 +03:00 committed by Storj Robot
parent 52ff7a66a0
commit bc30deee11

View File

@ -1064,7 +1064,7 @@ func TestMissingPieceDataRepair(t *testing.T) {
}
// TestCorruptDataRepair_Succeed does the following:
// - Uploads test data
// - Uploads test data using different hash algorithms (Blake3 and SHA256)
// - Kills some nodes carrying the uploaded segment but keep it above minimum requirement
// - On one of the remaining nodes, corrupt the piece data being stored by that node
// - Triggers data repair, which attempts to repair the data from the remaining nodes to
@ -1074,6 +1074,21 @@ func TestMissingPieceDataRepair(t *testing.T) {
func TestCorruptDataRepair_Succeed(t *testing.T) {
const RepairMaxExcessRateOptimalThreshold = 0.05
for _, tt := range []struct {
name string
hashAlgo pb.PieceHashAlgorithm
}{
{
name: "BLAKE3",
hashAlgo: pb.PieceHashAlgorithm_BLAKE3,
},
{
name: "SHA256",
hashAlgo: pb.PieceHashAlgorithm_SHA256,
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
testplanet.Run(t, testplanet.Config{
SatelliteCount: 1,
StorageNodeCount: 15,
@ -1101,7 +1116,7 @@ func TestCorruptDataRepair_Succeed(t *testing.T) {
var testData = testrand.Bytes(8 * memory.KiB)
// first, upload some remote data
err := uplinkPeer.Upload(ctx, satellite, "testbucket", "test/path", testData)
err := uplinkPeer.Upload(piecestore.WithPieceHashAlgo(ctx, tt.hashAlgo), satellite, "testbucket", "test/path", testData)
require.NoError(t, err)
segment, _ := getRemoteSegment(ctx, t, satellite, planet.Uplinks[0].Projects[0].ID, "testbucket")
@ -1177,6 +1192,8 @@ func TestCorruptDataRepair_Succeed(t *testing.T) {
require.NotEqual(t, piece.Number, corruptedPiece.Number, "there should be no corrupted piece in pointer")
}
})
})
}
}
// TestCorruptDataRepair_Failed does the following: