satellite/metainfo: uncomment tests, renamed EncryptedPath into EncryptedObjectKey
moved tests back and renamed params that were renamed on uplink side Change-Id: I4a9592bd955f2217c5809c235c394a4e78d337ea
This commit is contained in:
parent
bc3392cda4
commit
b6625cadea
2
go.mod
2
go.mod
@ -52,7 +52,7 @@ require (
|
||||
storj.io/drpc v0.0.26
|
||||
storj.io/monkit-jaeger v0.0.0-20210426161729-debb1cbcbbd7
|
||||
storj.io/private v0.0.0-20211209191323-6595d4aa0cfe
|
||||
storj.io/uplink v1.7.1-0.20211031201307-b30e004c1ccb
|
||||
storj.io/uplink v1.7.2-0.20220110164813-03e4f59f7af2
|
||||
)
|
||||
|
||||
require (
|
||||
|
9
go.sum
9
go.sum
@ -472,7 +472,6 @@ github.com/spacemonkeygo/monkit/v3 v3.0.4/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drX
|
||||
github.com/spacemonkeygo/monkit/v3 v3.0.5/go.mod h1:JcK1pCbReQsOsMKF/POFSZCq7drXFybgGmbc27tuwes=
|
||||
github.com/spacemonkeygo/monkit/v3 v3.0.7-0.20200515175308-072401d8c752/go.mod h1:kj1ViJhlyADa7DiA4xVnTuPA46lFKbM7mxQTrXCuJP4=
|
||||
github.com/spacemonkeygo/monkit/v3 v3.0.12/go.mod h1:kj1ViJhlyADa7DiA4xVnTuPA46lFKbM7mxQTrXCuJP4=
|
||||
github.com/spacemonkeygo/monkit/v3 v3.0.15/go.mod h1:kj1ViJhlyADa7DiA4xVnTuPA46lFKbM7mxQTrXCuJP4=
|
||||
github.com/spacemonkeygo/monkit/v3 v3.0.17 h1:rqIuLhRUr2UtS3WNVbPY/BwvjlwKVvSOVY5p0QVocxE=
|
||||
github.com/spacemonkeygo/monkit/v3 v3.0.17/go.mod h1:kj1ViJhlyADa7DiA4xVnTuPA46lFKbM7mxQTrXCuJP4=
|
||||
github.com/spacemonkeygo/monotime v0.0.0-20180824235756-e3f48a95f98a/go.mod h1:ul4bvvnCOPZgq8w0nTkSmWVg/hauVpFS97Am1YM1XXo=
|
||||
@ -604,7 +603,6 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP
|
||||
golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa h1:idItI2DDfCokpg0N51B2VtiLdJ4vAuXC9fnCb2gACo4=
|
||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
@ -729,8 +727,6 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211109065445-02f5c0300f6e h1:i6Vklmyu+fZMFYpum+sR4ZWABGW7MyIxfJZXYvcnbns=
|
||||
golang.org/x/sys v0.0.0-20211109065445-02f5c0300f6e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@ -884,7 +880,6 @@ sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2
|
||||
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
|
||||
storj.io/common v0.0.0-20200424175742-65ac59022f4f/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
|
||||
storj.io/common v0.0.0-20210805073808-8e0feb09e92a/go.mod h1:mhZYWpTojKsACxWE66RfXNz19zbyr/uEDVWHJH8dHog=
|
||||
storj.io/common v0.0.0-20211019072056-34a5992b4856/go.mod h1:objobGrIWQwhmTSpSm6Y7ykd40wZjB7CezNfic5YLKg=
|
||||
storj.io/common v0.0.0-20211217122906-6be0b96ce7e0 h1:xMUDQXSEzmhvmtC9jOqZEJ8jltjr3Hop4MxQlfUJ19Q=
|
||||
storj.io/common v0.0.0-20211217122906-6be0b96ce7e0/go.mod h1:Lufva6X8BVz5dEDNabpbjre4WVZr0x9sv3S90uVz7wk=
|
||||
storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw=
|
||||
@ -896,5 +891,5 @@ storj.io/monkit-jaeger v0.0.0-20210426161729-debb1cbcbbd7 h1:zi0w9zoBfvuqysSAqxJ
|
||||
storj.io/monkit-jaeger v0.0.0-20210426161729-debb1cbcbbd7/go.mod h1:gj4vuCeyCRjRmH8LIrgoyU9Dc9uR6H+/GcDUXmTbf80=
|
||||
storj.io/private v0.0.0-20211209191323-6595d4aa0cfe h1:gPf2s3d247JWd/Iqzw7g8mvpdlqdBpVTsBhe6oPMkKU=
|
||||
storj.io/private v0.0.0-20211209191323-6595d4aa0cfe/go.mod h1:BoSaGSvsC8C6Gy0FyjrHfsElJA623hLsNIyexs6vGno=
|
||||
storj.io/uplink v1.7.1-0.20211031201307-b30e004c1ccb h1:+WaWPmWvm12StirZ/b2xgbL9lnB7UmRhvC8fckNN1ZI=
|
||||
storj.io/uplink v1.7.1-0.20211031201307-b30e004c1ccb/go.mod h1:XvtDUEQplm3nG76Qo+uR59J7Rrwm9Q40XOwGpPSpF2g=
|
||||
storj.io/uplink v1.7.2-0.20220110164813-03e4f59f7af2 h1:+dvNcQNxdjffZTFsPEegunnQybAjINL+AoUq1aqMCR8=
|
||||
storj.io/uplink v1.7.2-0.20220110164813-03e4f59f7af2/go.mod h1:jDVW7WrKk6jpVT8MXZpaXU7g7iy8WBSrFifiiixIHRI=
|
||||
|
@ -6,18 +6,23 @@ package metainfo_test
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"storj.io/common/errs2"
|
||||
"storj.io/common/memory"
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/rpc/rpcstatus"
|
||||
"storj.io/common/signing"
|
||||
"storj.io/common/storj"
|
||||
"storj.io/common/testcontext"
|
||||
"storj.io/common/testrand"
|
||||
"storj.io/storj/private/testplanet"
|
||||
"storj.io/storj/satellite/metabase"
|
||||
"storj.io/uplink"
|
||||
"storj.io/uplink/private/metaclient"
|
||||
)
|
||||
|
||||
func TestEndpoint_DeleteCommittedObject(t *testing.T) {
|
||||
@ -393,186 +398,186 @@ func TestDeleteBucket(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// func TestCommitSegment_Validation(t *testing.T) {
|
||||
// testplanet.Run(t, testplanet.Config{
|
||||
// SatelliteCount: 1, StorageNodeCount: 1, UplinkCount: 1,
|
||||
// Reconfigure: testplanet.Reconfigure{
|
||||
// Satellite: testplanet.Combine(
|
||||
// testplanet.ReconfigureRS(1, 1, 1, 1),
|
||||
// ),
|
||||
// },
|
||||
// }, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
||||
// apiKey := planet.Uplinks[0].APIKey[planet.Satellites[0].ID()]
|
||||
// client, err := planet.Uplinks[0].DialMetainfo(ctx, planet.Satellites[0], apiKey)
|
||||
// require.NoError(t, err)
|
||||
// defer ctx.Check(client.Close)
|
||||
//
|
||||
// err = planet.Uplinks[0].CreateBucket(ctx, planet.Satellites[0], "testbucket")
|
||||
// require.NoError(t, err)
|
||||
//
|
||||
// beginObjectResponse, err := client.BeginObject(ctx, metaclient.BeginObjectParams{
|
||||
// Bucket: []byte("testbucket"),
|
||||
// EncryptedPath: []byte("a/b/testobject"),
|
||||
// EncryptionParameters: storj.EncryptionParameters{
|
||||
// CipherSuite: storj.EncAESGCM,
|
||||
// BlockSize: 256,
|
||||
// },
|
||||
// })
|
||||
// require.NoError(t, err)
|
||||
//
|
||||
// response, err := client.BeginSegment(ctx, metaclient.BeginSegmentParams{
|
||||
// StreamID: beginObjectResponse.StreamID,
|
||||
// Position: storj.SegmentPosition{
|
||||
// Index: 0,
|
||||
// },
|
||||
// MaxOrderLimit: memory.MiB.Int64(),
|
||||
// })
|
||||
// require.NoError(t, err)
|
||||
//
|
||||
// // the number of results of uploaded pieces (0) is below the optimal threshold (1)
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{},
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
//
|
||||
// // piece sizes are invalid: pointer verification: no remote pieces
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
// {},
|
||||
// },
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
//
|
||||
// // piece sizes are invalid: pointer verification: size is invalid (-1)
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
// {
|
||||
// Hash: &pb.PieceHash{
|
||||
// PieceSize: -1,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
//
|
||||
// // piece sizes are invalid: pointer verification: expected size is different from provided (768 != 10000)
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// SizeEncryptedData: 512,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
// {
|
||||
// Hash: &pb.PieceHash{
|
||||
// PieceSize: 10000,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
//
|
||||
// // piece sizes are invalid: pointer verification: sizes do not match (10000 != 9000)
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
// {
|
||||
// Hash: &pb.PieceHash{
|
||||
// PieceSize: 10000,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Hash: &pb.PieceHash{
|
||||
// PieceSize: 9000,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
//
|
||||
// // pointer verification failed: pointer verification: invalid piece number
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// SizeEncryptedData: 512,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
// {
|
||||
// PieceNum: 10,
|
||||
// NodeId: response.Limits[0].Limit.StorageNodeId,
|
||||
// Hash: &pb.PieceHash{
|
||||
// PieceSize: 768,
|
||||
// PieceId: response.Limits[0].Limit.PieceId,
|
||||
// Timestamp: time.Now(),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
//
|
||||
// // signature verification error (no signature)
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// SizeEncryptedData: 512,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
// {
|
||||
// PieceNum: 0,
|
||||
// NodeId: response.Limits[0].Limit.StorageNodeId,
|
||||
// Hash: &pb.PieceHash{
|
||||
// PieceSize: 768,
|
||||
// PieceId: response.Limits[0].Limit.PieceId,
|
||||
// Timestamp: time.Now(),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
//
|
||||
// signer := signing.SignerFromFullIdentity(planet.StorageNodes[0].Identity)
|
||||
// signedHash, err := signing.SignPieceHash(ctx, signer, &pb.PieceHash{
|
||||
// PieceSize: 768,
|
||||
// PieceId: response.Limits[0].Limit.PieceId,
|
||||
// Timestamp: time.Now(),
|
||||
// })
|
||||
// require.NoError(t, err)
|
||||
//
|
||||
// // pointer verification failed: pointer verification: nil identity returned
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// SizeEncryptedData: 512,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
// {
|
||||
// PieceNum: 0,
|
||||
// NodeId: testrand.NodeID(), // random node ID
|
||||
// Hash: signedHash,
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
//
|
||||
// // plain segment size 513 is out of range, maximum allowed is 512
|
||||
// err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
// SegmentID: response.SegmentID,
|
||||
// PlainSize: 513,
|
||||
// SizeEncryptedData: 512,
|
||||
// UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
// {
|
||||
// PieceNum: 0,
|
||||
// NodeId: response.Limits[0].Limit.StorageNodeId,
|
||||
// Hash: signedHash,
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// require.Error(t, err)
|
||||
// require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
// })
|
||||
//}
|
||||
func TestCommitSegment_Validation(t *testing.T) {
|
||||
testplanet.Run(t, testplanet.Config{
|
||||
SatelliteCount: 1, StorageNodeCount: 1, UplinkCount: 1,
|
||||
Reconfigure: testplanet.Reconfigure{
|
||||
Satellite: testplanet.Combine(
|
||||
testplanet.ReconfigureRS(1, 1, 1, 1),
|
||||
),
|
||||
},
|
||||
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
||||
apiKey := planet.Uplinks[0].APIKey[planet.Satellites[0].ID()]
|
||||
client, err := planet.Uplinks[0].DialMetainfo(ctx, planet.Satellites[0], apiKey)
|
||||
require.NoError(t, err)
|
||||
defer ctx.Check(client.Close)
|
||||
|
||||
err = planet.Uplinks[0].CreateBucket(ctx, planet.Satellites[0], "testbucket")
|
||||
require.NoError(t, err)
|
||||
|
||||
beginObjectResponse, err := client.BeginObject(ctx, metaclient.BeginObjectParams{
|
||||
Bucket: []byte("testbucket"),
|
||||
EncryptedObjectKey: []byte("a/b/testobject"),
|
||||
EncryptionParameters: storj.EncryptionParameters{
|
||||
CipherSuite: storj.EncAESGCM,
|
||||
BlockSize: 256,
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
response, err := client.BeginSegment(ctx, metaclient.BeginSegmentParams{
|
||||
StreamID: beginObjectResponse.StreamID,
|
||||
Position: storj.SegmentPosition{
|
||||
Index: 0,
|
||||
},
|
||||
MaxOrderLimit: memory.MiB.Int64(),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
// the number of results of uploaded pieces (0) is below the optimal threshold (1)
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
|
||||
// piece sizes are invalid: pointer verification: no remote pieces
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
{},
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
|
||||
// piece sizes are invalid: pointer verification: size is invalid (-1)
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
{
|
||||
Hash: &pb.PieceHash{
|
||||
PieceSize: -1,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
|
||||
// piece sizes are invalid: pointer verification: expected size is different from provided (768 != 10000)
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
SizeEncryptedData: 512,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
{
|
||||
Hash: &pb.PieceHash{
|
||||
PieceSize: 10000,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
|
||||
// piece sizes are invalid: pointer verification: sizes do not match (10000 != 9000)
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
{
|
||||
Hash: &pb.PieceHash{
|
||||
PieceSize: 10000,
|
||||
},
|
||||
},
|
||||
{
|
||||
Hash: &pb.PieceHash{
|
||||
PieceSize: 9000,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
|
||||
// pointer verification failed: pointer verification: invalid piece number
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
SizeEncryptedData: 512,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
{
|
||||
PieceNum: 10,
|
||||
NodeId: response.Limits[0].Limit.StorageNodeId,
|
||||
Hash: &pb.PieceHash{
|
||||
PieceSize: 768,
|
||||
PieceId: response.Limits[0].Limit.PieceId,
|
||||
Timestamp: time.Now(),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
|
||||
// signature verification error (no signature)
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
SizeEncryptedData: 512,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
{
|
||||
PieceNum: 0,
|
||||
NodeId: response.Limits[0].Limit.StorageNodeId,
|
||||
Hash: &pb.PieceHash{
|
||||
PieceSize: 768,
|
||||
PieceId: response.Limits[0].Limit.PieceId,
|
||||
Timestamp: time.Now(),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
|
||||
signer := signing.SignerFromFullIdentity(planet.StorageNodes[0].Identity)
|
||||
signedHash, err := signing.SignPieceHash(ctx, signer, &pb.PieceHash{
|
||||
PieceSize: 768,
|
||||
PieceId: response.Limits[0].Limit.PieceId,
|
||||
Timestamp: time.Now(),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
// pointer verification failed: pointer verification: nil identity returned
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
SizeEncryptedData: 512,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
{
|
||||
PieceNum: 0,
|
||||
NodeId: testrand.NodeID(), // random node ID
|
||||
Hash: signedHash,
|
||||
},
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
|
||||
// plain segment size 513 is out of range, maximum allowed is 512
|
||||
err = client.CommitSegment(ctx, metaclient.CommitSegmentParams{
|
||||
SegmentID: response.SegmentID,
|
||||
PlainSize: 513,
|
||||
SizeEncryptedData: 512,
|
||||
UploadResult: []*pb.SegmentPieceUploadResult{
|
||||
{
|
||||
PieceNum: 0,
|
||||
NodeId: response.Limits[0].Limit.StorageNodeId,
|
||||
Hash: signedHash,
|
||||
},
|
||||
},
|
||||
})
|
||||
require.Error(t, err)
|
||||
require.True(t, errs2.IsRPC(err, rpcstatus.InvalidArgument))
|
||||
})
|
||||
}
|
||||
|
||||
func TestEndpoint_UpdateObjectMetadata(t *testing.T) {
|
||||
testplanet.Run(t, testplanet.Config{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -232,5 +232,5 @@ require (
|
||||
storj.io/gateway v1.3.1-0.20211004141903-f55ba9105164 // indirect
|
||||
storj.io/minio v0.0.0-20211007171754-df6c27823c8a // indirect
|
||||
storj.io/monkit-jaeger v0.0.0-20210426161729-debb1cbcbbd7 // indirect
|
||||
storj.io/uplink v1.7.1-0.20211031201307-b30e004c1ccb // indirect
|
||||
storj.io/uplink v1.7.2-0.20220110164813-03e4f59f7af2 // indirect
|
||||
)
|
||||
|
@ -1398,7 +1398,6 @@ storj.io/common v0.0.0-20200424175742-65ac59022f4f/go.mod h1:pZyXiIE7bGETIRXtfs0
|
||||
storj.io/common v0.0.0-20210805073808-8e0feb09e92a/go.mod h1:mhZYWpTojKsACxWE66RfXNz19zbyr/uEDVWHJH8dHog=
|
||||
storj.io/common v0.0.0-20210916151047-6aaeb34bb916/go.mod h1:objobGrIWQwhmTSpSm6Y7ykd40wZjB7CezNfic5YLKg=
|
||||
storj.io/common v0.0.0-20211006105453-d3fff091f9d2/go.mod h1:objobGrIWQwhmTSpSm6Y7ykd40wZjB7CezNfic5YLKg=
|
||||
storj.io/common v0.0.0-20211019072056-34a5992b4856/go.mod h1:objobGrIWQwhmTSpSm6Y7ykd40wZjB7CezNfic5YLKg=
|
||||
storj.io/common v0.0.0-20211217122906-6be0b96ce7e0 h1:xMUDQXSEzmhvmtC9jOqZEJ8jltjr3Hop4MxQlfUJ19Q=
|
||||
storj.io/common v0.0.0-20211217122906-6be0b96ce7e0/go.mod h1:Lufva6X8BVz5dEDNabpbjre4WVZr0x9sv3S90uVz7wk=
|
||||
storj.io/dotworld v0.0.0-20210324183515-0d11aeccd840/go.mod h1:KU9YvEgRrMMiWLvH8pzn1UkoCoxggKIPvQxmNdx7aXQ=
|
||||
@ -1421,5 +1420,5 @@ storj.io/private v0.0.0-20211209191323-6595d4aa0cfe h1:gPf2s3d247JWd/Iqzw7g8mvpd
|
||||
storj.io/private v0.0.0-20211209191323-6595d4aa0cfe/go.mod h1:BoSaGSvsC8C6Gy0FyjrHfsElJA623hLsNIyexs6vGno=
|
||||
storj.io/uplink v1.6.0/go.mod h1:zqj/LFDxa6RMaSRSHOmukg3mMgesOry0iHSjNldDMGo=
|
||||
storj.io/uplink v1.7.0/go.mod h1:zqj/LFDxa6RMaSRSHOmukg3mMgesOry0iHSjNldDMGo=
|
||||
storj.io/uplink v1.7.1-0.20211031201307-b30e004c1ccb h1:+WaWPmWvm12StirZ/b2xgbL9lnB7UmRhvC8fckNN1ZI=
|
||||
storj.io/uplink v1.7.1-0.20211031201307-b30e004c1ccb/go.mod h1:XvtDUEQplm3nG76Qo+uR59J7Rrwm9Q40XOwGpPSpF2g=
|
||||
storj.io/uplink v1.7.2-0.20220110164813-03e4f59f7af2 h1:+dvNcQNxdjffZTFsPEegunnQybAjINL+AoUq1aqMCR8=
|
||||
storj.io/uplink v1.7.2-0.20220110164813-03e4f59f7af2/go.mod h1:jDVW7WrKk6jpVT8MXZpaXU7g7iy8WBSrFifiiixIHRI=
|
||||
|
Loading…
Reference in New Issue
Block a user