private/testplanet: remove dependency to uplink
Remove direct dependency on uplink.RSConfig, this simplifies moving the config file without introducing weird dependencies. Change-Id: I7fd2a145401e0205d7047631df9d2810241efeec
This commit is contained in:
parent
a35eb8027e
commit
2680bae88c
@ -19,6 +19,7 @@ import (
|
|||||||
|
|
||||||
"storj.io/common/identity"
|
"storj.io/common/identity"
|
||||||
"storj.io/common/macaroon"
|
"storj.io/common/macaroon"
|
||||||
|
"storj.io/common/memory"
|
||||||
"storj.io/common/pb"
|
"storj.io/common/pb"
|
||||||
"storj.io/common/peertls/tlsopts"
|
"storj.io/common/peertls/tlsopts"
|
||||||
"storj.io/common/rpc"
|
"storj.io/common/rpc"
|
||||||
@ -169,28 +170,28 @@ func (client *Uplink) UploadWithExpiration(ctx context.Context, satellite *Satel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UploadWithConfig uploads data to specific satellite with configured values
|
// UploadWithConfig uploads data to specific satellite with configured values
|
||||||
func (client *Uplink) UploadWithConfig(ctx context.Context, satellite *SatelliteSystem, redundancy *uplink.RSConfig, bucket string, path storj.Path, data []byte) error {
|
func (client *Uplink) UploadWithConfig(ctx context.Context, satellite *SatelliteSystem, redundancy *storj.RedundancyScheme, bucket string, path storj.Path, data []byte) error {
|
||||||
return client.UploadWithExpirationAndConfig(ctx, satellite, redundancy, bucket, path, data, time.Time{})
|
return client.UploadWithExpirationAndConfig(ctx, satellite, redundancy, bucket, path, data, time.Time{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// UploadWithExpirationAndConfig uploads data to specific satellite with configured values and expiration time
|
// UploadWithExpirationAndConfig uploads data to specific satellite with configured values and expiration time
|
||||||
func (client *Uplink) UploadWithExpirationAndConfig(ctx context.Context, satellite *SatelliteSystem, redundancy *uplink.RSConfig, bucketName string, path storj.Path, data []byte, expiration time.Time) (err error) {
|
func (client *Uplink) UploadWithExpirationAndConfig(ctx context.Context, satellite *SatelliteSystem, redundancy *storj.RedundancyScheme, bucketName string, path storj.Path, data []byte, expiration time.Time) (err error) {
|
||||||
config := client.GetConfig(satellite)
|
config := client.GetConfig(satellite)
|
||||||
if redundancy != nil {
|
if redundancy != nil {
|
||||||
if redundancy.MinThreshold > 0 {
|
if redundancy.RequiredShares > 0 {
|
||||||
config.RS.MinThreshold = redundancy.MinThreshold
|
config.RS.MinThreshold = int(redundancy.RequiredShares)
|
||||||
}
|
}
|
||||||
if redundancy.RepairThreshold > 0 {
|
if redundancy.RepairShares > 0 {
|
||||||
config.RS.RepairThreshold = redundancy.RepairThreshold
|
config.RS.RepairThreshold = int(redundancy.RepairShares)
|
||||||
}
|
}
|
||||||
if redundancy.SuccessThreshold > 0 {
|
if redundancy.OptimalShares > 0 {
|
||||||
config.RS.SuccessThreshold = redundancy.SuccessThreshold
|
config.RS.SuccessThreshold = int(redundancy.OptimalShares)
|
||||||
}
|
}
|
||||||
if redundancy.MaxThreshold > 0 {
|
if redundancy.TotalShares > 0 {
|
||||||
config.RS.MaxThreshold = redundancy.MaxThreshold
|
config.RS.MaxThreshold = int(redundancy.TotalShares)
|
||||||
}
|
}
|
||||||
if redundancy.ErasureShareSize > 0 {
|
if redundancy.ShareSize > 0 {
|
||||||
config.RS.ErasureShareSize = redundancy.ErasureShareSize
|
config.RS.ErasureShareSize = memory.Size(redundancy.ShareSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ import (
|
|||||||
"storj.io/storj/pkg/server"
|
"storj.io/storj/pkg/server"
|
||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
"storj.io/storj/satellite/overlay"
|
"storj.io/storj/satellite/overlay"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
"storj.io/storj/uplink/metainfo"
|
"storj.io/storj/uplink/metainfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -81,11 +80,12 @@ func TestDownloadWithSomeNodesOffline(t *testing.T) {
|
|||||||
|
|
||||||
testData := testrand.Bytes(memory.MiB)
|
testData := testrand.Bytes(memory.MiB)
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 3,
|
||||||
MaxThreshold: 5,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 5,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -198,11 +198,12 @@ func TestDownloadFromUnresponsiveNode(t *testing.T) {
|
|||||||
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
||||||
expectedData := testrand.Bytes(memory.MiB)
|
expectedData := testrand.Bytes(memory.MiB)
|
||||||
|
|
||||||
err := planet.Uplinks[0].UploadWithConfig(ctx, planet.Satellites[0], &uplink.RSConfig{
|
err := planet.Uplinks[0].UploadWithConfig(ctx, planet.Satellites[0], &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 3,
|
||||||
MaxThreshold: 5,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 5,
|
||||||
}, "testbucket", "test/path", expectedData)
|
}, "testbucket", "test/path", expectedData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ import (
|
|||||||
"storj.io/common/testrand"
|
"storj.io/common/testrand"
|
||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
"storj.io/storj/satellite/audit"
|
"storj.io/storj/satellite/audit"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestAuditPathCollector does the following:
|
// TestAuditPathCollector does the following:
|
||||||
@ -43,11 +42,12 @@ func TestAuditPathCollector(t *testing.T) {
|
|||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
path := "/some/remote/path/" + string(i)
|
path := "/some/remote/path/" + string(i)
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 4,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 5,
|
RepairShares: 4,
|
||||||
MaxThreshold: 5,
|
OptimalShares: 5,
|
||||||
|
TotalShares: 5,
|
||||||
}, "testbucket", path, testData)
|
}, "testbucket", path, testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import (
|
|||||||
"storj.io/storj/satellite/audit"
|
"storj.io/storj/satellite/audit"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
"storj.io/storj/storagenode"
|
"storj.io/storj/storagenode"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestReverifySuccess(t *testing.T) {
|
func TestReverifySuccess(t *testing.T) {
|
||||||
@ -504,11 +503,12 @@ func TestReverifyDeletedSegment(t *testing.T) {
|
|||||||
|
|
||||||
ul := planet.Uplinks[0]
|
ul := planet.Uplinks[0]
|
||||||
testData1 := testrand.Bytes(8 * memory.KiB)
|
testData1 := testrand.Bytes(8 * memory.KiB)
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 1,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 1,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 2,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testData1)
|
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testData1)
|
||||||
@ -592,11 +592,12 @@ func TestReverifyModifiedSegment(t *testing.T) {
|
|||||||
|
|
||||||
ul := planet.Uplinks[0]
|
ul := planet.Uplinks[0]
|
||||||
testData1 := testrand.Bytes(8 * memory.KiB)
|
testData1 := testrand.Bytes(8 * memory.KiB)
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 1,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 1,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 2,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}
|
}
|
||||||
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testData1)
|
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testData1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -683,11 +684,12 @@ func TestReverifyDifferentShare(t *testing.T) {
|
|||||||
testData1 := testrand.Bytes(8 * memory.KiB)
|
testData1 := testrand.Bytes(8 * memory.KiB)
|
||||||
testData2 := testrand.Bytes(8 * memory.KiB)
|
testData2 := testrand.Bytes(8 * memory.KiB)
|
||||||
// upload to three nodes so there is definitely at least one node overlap between the two files
|
// upload to three nodes so there is definitely at least one node overlap between the two files
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 1,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 1,
|
||||||
SuccessThreshold: 3,
|
RepairShares: 2,
|
||||||
MaxThreshold: 3,
|
OptimalShares: 3,
|
||||||
|
TotalShares: 3,
|
||||||
}
|
}
|
||||||
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testData1)
|
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testData1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -843,11 +845,12 @@ func TestReverifyExpired2(t *testing.T) {
|
|||||||
testData1 := testrand.Bytes(8 * memory.KiB)
|
testData1 := testrand.Bytes(8 * memory.KiB)
|
||||||
testData2 := testrand.Bytes(8 * memory.KiB)
|
testData2 := testrand.Bytes(8 * memory.KiB)
|
||||||
// upload to three nodes so there is definitely at least one node overlap between the two files
|
// upload to three nodes so there is definitely at least one node overlap between the two files
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 1,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 1,
|
||||||
SuccessThreshold: 3,
|
RepairShares: 2,
|
||||||
MaxThreshold: 3,
|
OptimalShares: 3,
|
||||||
|
TotalShares: 3,
|
||||||
}
|
}
|
||||||
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testData1)
|
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testData1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -977,11 +980,12 @@ func TestReverifySlowDownload(t *testing.T) {
|
|||||||
ul := planet.Uplinks[0]
|
ul := planet.Uplinks[0]
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 2,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -1069,11 +1073,12 @@ func TestReverifyUnknownError(t *testing.T) {
|
|||||||
ul := planet.Uplinks[0]
|
ul := planet.Uplinks[0]
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 2,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ import (
|
|||||||
"storj.io/storj/satellite/audit"
|
"storj.io/storj/satellite/audit"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
"storj.io/storj/storagenode"
|
"storj.io/storj/storagenode"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestDownloadSharesHappyPath checks that the Share.Error field of all shares
|
// TestDownloadSharesHappyPath checks that the Share.Error field of all shares
|
||||||
@ -753,11 +752,12 @@ func TestVerifierSlowDownload(t *testing.T) {
|
|||||||
ul := planet.Uplinks[0]
|
ul := planet.Uplinks[0]
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 2,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -811,11 +811,12 @@ func TestVerifierUnknownError(t *testing.T) {
|
|||||||
ul := planet.Uplinks[0]
|
ul := planet.Uplinks[0]
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 2,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
"storj.io/storj/satellite/overlay"
|
"storj.io/storj/satellite/overlay"
|
||||||
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChore(t *testing.T) {
|
func TestChore(t *testing.T) {
|
||||||
@ -44,11 +43,12 @@ func TestChore(t *testing.T) {
|
|||||||
|
|
||||||
satellite.GracefulExit.Chore.Loop.Pause()
|
satellite.GracefulExit.Chore.Loop.Pause()
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 4,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 6,
|
RequiredShares: 4,
|
||||||
SuccessThreshold: 8,
|
RepairShares: 6,
|
||||||
MaxThreshold: 8,
|
OptimalShares: 8,
|
||||||
|
TotalShares: 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
||||||
@ -148,11 +148,12 @@ func TestDurabilityRatio(t *testing.T) {
|
|||||||
|
|
||||||
satellite.GracefulExit.Chore.Loop.Pause()
|
satellite.GracefulExit.Chore.Loop.Pause()
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 3,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
||||||
@ -222,7 +223,7 @@ func TestDurabilityRatio(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, incompleteTransfers, 1)
|
require.Len(t, incompleteTransfers, 1)
|
||||||
for _, incomplete := range incompleteTransfers {
|
for _, incomplete := range incompleteTransfers {
|
||||||
require.Equal(t, float64(rs.SuccessThreshold-1)/float64(rs.SuccessThreshold), incomplete.DurabilityRatio)
|
require.Equal(t, float64(rs.OptimalShares-1)/float64(rs.OptimalShares), incomplete.DurabilityRatio)
|
||||||
require.NotNil(t, incomplete.RootPieceID)
|
require.NotNil(t, incomplete.RootPieceID)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -35,7 +35,6 @@ import (
|
|||||||
"storj.io/storj/storagenode"
|
"storj.io/storj/storagenode"
|
||||||
"storj.io/storj/storagenode/gracefulexit"
|
"storj.io/storj/storagenode/gracefulexit"
|
||||||
"storj.io/storj/storagenode/pieces"
|
"storj.io/storj/storagenode/pieces"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const numObjects = 6
|
const numObjects = 6
|
||||||
@ -158,11 +157,12 @@ func TestConcurrentConnections(t *testing.T) {
|
|||||||
|
|
||||||
satellite.GracefulExit.Chore.Loop.Pause()
|
satellite.GracefulExit.Chore.Loop.Pause()
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: 3,
|
||||||
MaxThreshold: successThreshold,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: int16(successThreshold),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
||||||
@ -261,11 +261,12 @@ func TestRecvTimeout(t *testing.T) {
|
|||||||
|
|
||||||
satellite.GracefulExit.Chore.Loop.Pause()
|
satellite.GracefulExit.Chore.Loop.Pause()
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: 3,
|
||||||
MaxThreshold: successThreshold,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: int16(successThreshold),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
||||||
@ -970,11 +971,12 @@ func TestPointerChangedOrDeleted(t *testing.T) {
|
|||||||
|
|
||||||
satellite.GracefulExit.Chore.Loop.Pause()
|
satellite.GracefulExit.Chore.Loop.Pause()
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: 3,
|
||||||
MaxThreshold: successThreshold,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: int16(successThreshold),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path0", testrand.Bytes(5*memory.KiB))
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path0", testrand.Bytes(5*memory.KiB))
|
||||||
@ -1237,11 +1239,12 @@ func TestFailureStorageNodeIgnoresTransferMessages(t *testing.T) {
|
|||||||
nodeFullIDs[node.ID()] = node.Identity
|
nodeFullIDs[node.ID()] = node.Identity
|
||||||
}
|
}
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 3,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path", testrand.Bytes(5*memory.KiB))
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path", testrand.Bytes(5*memory.KiB))
|
||||||
@ -1367,11 +1370,12 @@ func TestIneligibleNodeAge(t *testing.T) {
|
|||||||
nodeFullIDs[node.ID()] = node.Identity
|
nodeFullIDs[node.ID()] = node.Identity
|
||||||
}
|
}
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 3,
|
||||||
MaxThreshold: 4,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path", testrand.Bytes(5*memory.KiB))
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path", testrand.Bytes(5*memory.KiB))
|
||||||
@ -1427,11 +1431,12 @@ func testTransfers(t *testing.T, objects int, verifier func(ctx *testcontext.Con
|
|||||||
nodeFullIDs[node.ID()] = node.Identity
|
nodeFullIDs[node.ID()] = node.Identity
|
||||||
}
|
}
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: 3,
|
||||||
MaxThreshold: successThreshold,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: int16(successThreshold),
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < objects; i++ {
|
for i := 0; i < objects; i++ {
|
||||||
|
@ -28,7 +28,6 @@ import (
|
|||||||
"storj.io/common/testrand"
|
"storj.io/common/testrand"
|
||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
"storj.io/storj/satellite"
|
"storj.io/storj/satellite"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
"storj.io/storj/uplink/eestream"
|
"storj.io/storj/uplink/eestream"
|
||||||
"storj.io/storj/uplink/metainfo"
|
"storj.io/storj/uplink/metainfo"
|
||||||
)
|
)
|
||||||
@ -1742,28 +1741,29 @@ func TestValidateRS(t *testing.T) {
|
|||||||
satellite := planet.Satellites[0]
|
satellite := planet.Satellites[0]
|
||||||
|
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 1,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 2,
|
RequiredShares: 1,
|
||||||
SuccessThreshold: 3,
|
RepairShares: 2,
|
||||||
MaxThreshold: 3,
|
OptimalShares: 3,
|
||||||
|
TotalShares: 3,
|
||||||
}
|
}
|
||||||
// test below permitted total value
|
// test below permitted total value
|
||||||
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path/below", testData)
|
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path/below", testData)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
|
|
||||||
// test above permitted total value
|
// test above permitted total value
|
||||||
rs.MaxThreshold = 6
|
rs.TotalShares = 6
|
||||||
err = ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path/above", testData)
|
err = ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path/above", testData)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
|
|
||||||
// test minimum permitted total value
|
// test minimum permitted total value
|
||||||
rs.MaxThreshold = 4
|
rs.TotalShares = 4
|
||||||
err = ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path/min", testData)
|
err = ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path/min", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// test maximum permitted total value
|
// test maximum permitted total value
|
||||||
rs.MaxThreshold = 5
|
rs.TotalShares = 5
|
||||||
err = ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path/max", testData)
|
err = ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path/max", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
@ -17,7 +17,6 @@ import (
|
|||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
"storj.io/storj/satellite/metainfo"
|
"storj.io/storj/satellite/metainfo"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIterate(t *testing.T) {
|
func TestIterate(t *testing.T) {
|
||||||
@ -67,11 +66,12 @@ func TestUpdatePiecesCheckDuplicates(t *testing.T) {
|
|||||||
uplinkPeer := planet.Uplinks[0]
|
uplinkPeer := planet.Uplinks[0]
|
||||||
path := "test/path"
|
path := "test/path"
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 1,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 1,
|
RequiredShares: 1,
|
||||||
SuccessThreshold: 2,
|
RepairShares: 1,
|
||||||
MaxThreshold: 2,
|
OptimalShares: 2,
|
||||||
|
TotalShares: 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "test1", path, testrand.Bytes(5*memory.KiB))
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, rs, "test1", path, testrand.Bytes(5*memory.KiB))
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"storj.io/common/memory"
|
"storj.io/common/memory"
|
||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
"storj.io/common/testrand"
|
"storj.io/common/testrand"
|
||||||
|
"storj.io/storj/pkg/storj"
|
||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCounterInlineAndRemote(t *testing.T) {
|
func TestCounterInlineAndRemote(t *testing.T) {
|
||||||
@ -38,11 +38,12 @@ func TestCounterInlineAndRemote(t *testing.T) {
|
|||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
testData := testrand.Bytes(segmentSize)
|
testData := testrand.Bytes(segmentSize)
|
||||||
path := "/some/remote/path/" + string(i)
|
path := "/some/remote/path/" + string(i)
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 4,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 5,
|
RepairShares: 4,
|
||||||
MaxThreshold: 5,
|
OptimalShares: 5,
|
||||||
|
TotalShares: 5,
|
||||||
}, "testbucket", path, testData)
|
}, "testbucket", path, testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
@ -91,11 +92,12 @@ func TestCounterRemoteOnly(t *testing.T) {
|
|||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
path := "/some/remote/path/" + string(i)
|
path := "/some/remote/path/" + string(i)
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 4,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 5,
|
RepairShares: 4,
|
||||||
MaxThreshold: 5,
|
OptimalShares: 5,
|
||||||
|
TotalShares: 5,
|
||||||
}, "testbucket", path, testData)
|
}, "testbucket", path, testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
"storj.io/storj/satellite/orders"
|
"storj.io/storj/satellite/orders"
|
||||||
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
||||||
snorders "storj.io/storj/storagenode/orders"
|
snorders "storj.io/storj/storagenode/orders"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSendingReceivingOrders(t *testing.T) {
|
func TestSendingReceivingOrders(t *testing.T) {
|
||||||
@ -235,9 +234,9 @@ func TestUploadDownloadBandwidth(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func noLongTailRedundancy(planet *testplanet.Planet) uplink.RSConfig {
|
func noLongTailRedundancy(planet *testplanet.Planet) storj.RedundancyScheme {
|
||||||
redundancy := planet.Uplinks[0].GetConfig(planet.Satellites[0]).RS
|
redundancy := planet.Uplinks[0].GetConfig(planet.Satellites[0]).GetRedundancyScheme()
|
||||||
redundancy.SuccessThreshold = redundancy.MaxThreshold
|
redundancy.OptimalShares = redundancy.TotalShares
|
||||||
return redundancy
|
return redundancy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
"storj.io/storj/satellite/overlay"
|
"storj.io/storj/satellite/overlay"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
"storj.io/storj/storagenode"
|
"storj.io/storj/storagenode"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestDataRepair does the following:
|
// TestDataRepair does the following:
|
||||||
@ -63,11 +62,12 @@ func TestDataRepair(t *testing.T) {
|
|||||||
minThreshold = 3
|
minThreshold = 3
|
||||||
successThreshold = 7
|
successThreshold = 7
|
||||||
)
|
)
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: minThreshold,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 5,
|
RequiredShares: int16(minThreshold),
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: 5,
|
||||||
MaxThreshold: 9,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: 9,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -188,11 +188,12 @@ func TestCorruptDataRepair_Failed(t *testing.T) {
|
|||||||
|
|
||||||
var testData = testrand.Bytes(8 * memory.KiB)
|
var testData = testrand.Bytes(8 * memory.KiB)
|
||||||
// first, upload some remote data
|
// first, upload some remote data
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 5,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 7,
|
RepairShares: 5,
|
||||||
MaxThreshold: 9,
|
OptimalShares: 7,
|
||||||
|
TotalShares: 9,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -304,11 +305,12 @@ func TestCorruptDataRepair_Succeed(t *testing.T) {
|
|||||||
|
|
||||||
var testData = testrand.Bytes(8 * memory.KiB)
|
var testData = testrand.Bytes(8 * memory.KiB)
|
||||||
// first, upload some remote data
|
// first, upload some remote data
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 5,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 7,
|
RepairShares: 5,
|
||||||
MaxThreshold: 9,
|
OptimalShares: 7,
|
||||||
|
TotalShares: 9,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -416,11 +418,12 @@ func TestRemoveDeletedSegmentFromQueue(t *testing.T) {
|
|||||||
|
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 5,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 7,
|
RepairShares: 5,
|
||||||
MaxThreshold: 7,
|
OptimalShares: 7,
|
||||||
|
TotalShares: 7,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -496,11 +499,12 @@ func TestRemoveIrreparableSegmentFromQueue(t *testing.T) {
|
|||||||
|
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 5,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 7,
|
RepairShares: 5,
|
||||||
MaxThreshold: 7,
|
OptimalShares: 7,
|
||||||
|
TotalShares: 7,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -576,11 +580,12 @@ func TestRepairMultipleDisqualified(t *testing.T) {
|
|||||||
|
|
||||||
testData := testrand.Bytes(8 * memory.KiB)
|
testData := testrand.Bytes(8 * memory.KiB)
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 5,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 7,
|
RepairShares: 5,
|
||||||
MaxThreshold: 7,
|
OptimalShares: 7,
|
||||||
|
TotalShares: 7,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -686,11 +691,12 @@ func TestDataRepairOverride_HigherLimit(t *testing.T) {
|
|||||||
|
|
||||||
var testData = testrand.Bytes(8 * memory.KiB)
|
var testData = testrand.Bytes(8 * memory.KiB)
|
||||||
// first, upload some remote data
|
// first, upload some remote data
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 4,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 9,
|
RepairShares: 4,
|
||||||
MaxThreshold: 9,
|
OptimalShares: 9,
|
||||||
|
TotalShares: 9,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -771,11 +777,12 @@ func TestDataRepairOverride_LowerLimit(t *testing.T) {
|
|||||||
|
|
||||||
var testData = testrand.Bytes(8 * memory.KiB)
|
var testData = testrand.Bytes(8 * memory.KiB)
|
||||||
// first, upload some remote data
|
// first, upload some remote data
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := uplinkPeer.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 6,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: 9,
|
RepairShares: 6,
|
||||||
MaxThreshold: 9,
|
OptimalShares: 9,
|
||||||
|
TotalShares: 9,
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@ -897,11 +904,12 @@ func TestDataRepairUploadLimit(t *testing.T) {
|
|||||||
testData = testrand.Bytes(8 * memory.KiB)
|
testData = testrand.Bytes(8 * memory.KiB)
|
||||||
)
|
)
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, &uplink.RSConfig{
|
err := ul.UploadWithConfig(ctx, satellite, &storj.RedundancyScheme{
|
||||||
MinThreshold: 3,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: repairThreshold,
|
RequiredShares: 3,
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: int16(repairThreshold),
|
||||||
MaxThreshold: maxThreshold,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: int16(maxThreshold),
|
||||||
}, "testbucket", "test/path", testData)
|
}, "testbucket", "test/path", testData)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
"storj.io/common/testrand"
|
"storj.io/common/testrand"
|
||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCollector(t *testing.T) {
|
func TestCollector(t *testing.T) {
|
||||||
@ -33,11 +32,12 @@ func TestCollector(t *testing.T) {
|
|||||||
// upload some data to exactly 2 nodes that expires in 8 days
|
// upload some data to exactly 2 nodes that expires in 8 days
|
||||||
err := planet.Uplinks[0].UploadWithExpirationAndConfig(ctx,
|
err := planet.Uplinks[0].UploadWithExpirationAndConfig(ctx,
|
||||||
planet.Satellites[0],
|
planet.Satellites[0],
|
||||||
&uplink.RSConfig{
|
&storj.RedundancyScheme{
|
||||||
MinThreshold: 1,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 1,
|
RequiredShares: 1,
|
||||||
SuccessThreshold: 2,
|
RepairShares: 1,
|
||||||
MaxThreshold: 2,
|
OptimalShares: 2,
|
||||||
|
TotalShares: 2,
|
||||||
},
|
},
|
||||||
"testbucket", "test/path",
|
"testbucket", "test/path",
|
||||||
expectedData, time.Now().Add(8*24*time.Hour))
|
expectedData, time.Now().Add(8*24*time.Hour))
|
||||||
|
@ -19,7 +19,6 @@ import (
|
|||||||
"storj.io/storj/satellite/overlay"
|
"storj.io/storj/satellite/overlay"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
"storj.io/storj/storagenode"
|
"storj.io/storj/storagenode"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChore(t *testing.T) {
|
func TestChore(t *testing.T) {
|
||||||
@ -34,11 +33,12 @@ func TestChore(t *testing.T) {
|
|||||||
|
|
||||||
satellite1.GracefulExit.Chore.Loop.Pause()
|
satellite1.GracefulExit.Chore.Loop.Pause()
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: 3,
|
||||||
MaxThreshold: successThreshold,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: int16(successThreshold),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := uplinkPeer.UploadWithConfig(ctx, satellite1, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
err := uplinkPeer.UploadWithConfig(ctx, satellite1, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"go.uber.org/zap/zaptest"
|
"go.uber.org/zap/zaptest"
|
||||||
|
|
||||||
"storj.io/common/memory"
|
"storj.io/common/memory"
|
||||||
|
"storj.io/common/storj"
|
||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
"storj.io/common/testrand"
|
"storj.io/common/testrand"
|
||||||
"storj.io/storj/private/testblobs"
|
"storj.io/storj/private/testblobs"
|
||||||
@ -20,7 +21,6 @@ import (
|
|||||||
"storj.io/storj/storagenode"
|
"storj.io/storj/storagenode"
|
||||||
"storj.io/storj/storagenode/gracefulexit"
|
"storj.io/storj/storagenode/gracefulexit"
|
||||||
"storj.io/storj/storagenode/pieces"
|
"storj.io/storj/storagenode/pieces"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWorkerSuccess(t *testing.T) {
|
func TestWorkerSuccess(t *testing.T) {
|
||||||
@ -35,11 +35,12 @@ func TestWorkerSuccess(t *testing.T) {
|
|||||||
|
|
||||||
satellite.GracefulExit.Chore.Loop.Pause()
|
satellite.GracefulExit.Chore.Loop.Pause()
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: 3,
|
||||||
MaxThreshold: successThreshold,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: int16(successThreshold),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
||||||
@ -113,11 +114,12 @@ func TestWorkerTimeout(t *testing.T) {
|
|||||||
|
|
||||||
satellite.GracefulExit.Chore.Loop.Pause()
|
satellite.GracefulExit.Chore.Loop.Pause()
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: successThreshold,
|
RepairShares: 3,
|
||||||
MaxThreshold: successThreshold,
|
OptimalShares: int16(successThreshold),
|
||||||
|
TotalShares: int16(successThreshold),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
err := ul.UploadWithConfig(ctx, satellite, rs, "testbucket", "test/path1", testrand.Bytes(5*memory.KiB))
|
||||||
|
@ -12,11 +12,11 @@ import (
|
|||||||
|
|
||||||
"storj.io/common/memory"
|
"storj.io/common/memory"
|
||||||
"storj.io/common/pb"
|
"storj.io/common/pb"
|
||||||
|
"storj.io/common/storj"
|
||||||
"storj.io/common/sync2"
|
"storj.io/common/sync2"
|
||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
"storj.io/common/testrand"
|
"storj.io/common/testrand"
|
||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
"storj.io/storj/uplink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInspectorStats(t *testing.T) {
|
func TestInspectorStats(t *testing.T) {
|
||||||
@ -43,11 +43,12 @@ func TestInspectorStats(t *testing.T) {
|
|||||||
|
|
||||||
expectedData := testrand.Bytes(100 * memory.KiB)
|
expectedData := testrand.Bytes(100 * memory.KiB)
|
||||||
|
|
||||||
rs := &uplink.RSConfig{
|
rs := &storj.RedundancyScheme{
|
||||||
MinThreshold: 2,
|
Algorithm: storj.ReedSolomon,
|
||||||
RepairThreshold: 3,
|
RequiredShares: 2,
|
||||||
SuccessThreshold: 4,
|
RepairShares: 3,
|
||||||
MaxThreshold: 5,
|
OptimalShares: 4,
|
||||||
|
TotalShares: 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := planet.Uplinks[0].UploadWithConfig(ctx, planet.Satellites[0], rs, "testbucket", "test/path", expectedData)
|
err := planet.Uplinks[0].UploadWithConfig(ctx, planet.Satellites[0], rs, "testbucket", "test/path", expectedData)
|
||||||
@ -93,7 +94,7 @@ func TestInspectorStats(t *testing.T) {
|
|||||||
assert.Equal(t, availableSpace, response.AvailableSpace)
|
assert.Equal(t, availableSpace, response.AvailableSpace)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert.True(t, downloaded >= rs.MinThreshold, "downloaded=%v, rs.MinThreshold=%v", downloaded, rs.MinThreshold)
|
assert.True(t, downloaded >= int(rs.RequiredShares), "downloaded=%v, rs.RequiredShares=%v", downloaded, rs.RequiredShares)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user