Documentation ¶
Overview ¶
Package testplanet implements the full network wiring for testing
Index ¶
- Variables
- func Run(t *testing.T, config Config, ...)
- type Config
- type DatabaseConfig
- type DefaultReferralManagerServer
- func (server *DefaultReferralManagerServer) GetTokens(ctx context.Context, req *pb.GetTokensRequest) (*pb.GetTokensResponse, error)
- func (server *DefaultReferralManagerServer) RedeemToken(ctx context.Context, req *pb.RedeemTokenRequest) (*pb.RedeemTokenResponse, error)
- func (server *DefaultReferralManagerServer) SetTokenCount(tokenCount int)
- type Peer
- type Planet
- func (planet *Planet) FindNode(nodeID storj.NodeID) *StorageNode
- func (planet *Planet) Identities() *testidentity.Identities
- func (planet *Planet) NewIdentity() (*identity.FullIdentity, error)
- func (planet *Planet) NewListener() (net.Listener, error)
- func (planet *Planet) NewVersionConfig() checker.Config
- func (planet *Planet) NewVersionInfo() version.Info
- func (planet *Planet) Shutdown() error
- func (planet *Planet) Size() int
- func (planet *Planet) Start(ctx context.Context)
- func (planet *Planet) StopNodeAndUpdate(ctx context.Context, node *StorageNode) error
- func (planet *Planet) StopPeer(peer Peer) error
- func (planet *Planet) WaitForStorageNodeDeleters(ctx context.Context)
- func (planet *Planet) WaitForStorageNodeEndpoints(ctx context.Context) error
- func (planet *Planet) WriteWhitelist(version storj.IDVersion) (string, error)
- type Project
- type ProjectOwner
- type Reconfigure
- type Satellite
- func (system *Satellite) AddProject(ctx context.Context, ownerID uuid.UUID, name string) (*console.Project, error)
- func (system *Satellite) AddUser(ctx context.Context, newUser console.CreateUser, maxNumberOfProjects int) (*console.User, error)
- func (system *Satellite) Addr() string
- func (system *Satellite) AuthenticatedContext(ctx context.Context, userID uuid.UUID) (context.Context, error)
- func (system *Satellite) Close() error
- func (system *Satellite) ID() storj.NodeID
- func (system *Satellite) NodeURL() storj.NodeURL
- func (system *Satellite) PrivateAddr() string
- func (system *Satellite) Run(ctx context.Context) (err error)
- func (system *Satellite) URL() string
- type StorageNode
- type Uplink
- func (client *Uplink) Addr() string
- func (client *Uplink) CreateBucket(ctx context.Context, satellite *Satellite, bucketName string) error
- func (client *Uplink) DeleteBucket(ctx context.Context, satellite *Satellite, bucketName string) error
- func (client *Uplink) DeleteObject(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path) error
- func (client *Uplink) DialMetainfo(ctx context.Context, destination Peer, apikey *macaroon.APIKey) (*metainfo.Client, error)
- func (client *Uplink) DialPiecestore(ctx context.Context, destination Peer) (*piecestore.Client, error)
- func (client *Uplink) Download(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path) ([]byte, error)
- func (client *Uplink) DownloadStream(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path) (_ io.ReadCloser, cleanup func() error, err error)
- func (client *Uplink) DownloadStreamRange(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path, ...) (_ io.ReadCloser, cleanup func() error, err error)
- func (client *Uplink) GetProject(ctx context.Context, satellite *Satellite) (*uplink.Project, error)
- func (client *Uplink) ID() storj.NodeID
- func (client *Uplink) Shutdown() error
- func (client *Uplink) Upload(ctx context.Context, satellite *Satellite, bucket string, path storj.Path, ...) error
- func (client *Uplink) UploadWithExpiration(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path, ...) error
Constants ¶
This section is empty.
Variables ¶
var Combine = func(elements ...func(log *zap.Logger, index int, config *satellite.Config)) func(log *zap.Logger, index int, config *satellite.Config) { return func(log *zap.Logger, index int, config *satellite.Config) { for _, f := range elements { f(log, index, config) } } }
Combine combines satellite reconfigure functions.
var DisablePeerCAWhitelist = Reconfigure{ Satellite: func(log *zap.Logger, index int, config *satellite.Config) { config.Server.UsePeerCAWhitelist = false }, StorageNode: func(index int, config *storagenode.Config) { config.Server.UsePeerCAWhitelist = false }, }
DisablePeerCAWhitelist returns a `Reconfigure` that sets `UsePeerCAWhitelist` for all node types that use kademlia.
var MaxMetadataSize = func(maxMetadataSize memory.Size) func(log *zap.Logger, index int, config *satellite.Config) { return func(log *zap.Logger, index int, config *satellite.Config) { config.Metainfo.MaxMetadataSize = maxMetadataSize } }
MaxMetadataSize returns function to change satellite max metadata size value.
var MaxSegmentSize = func(maxSegmentSize memory.Size) func(log *zap.Logger, index int, config *satellite.Config) { return func(log *zap.Logger, index int, config *satellite.Config) { config.Metainfo.MaxSegmentSize = maxSegmentSize } }
MaxSegmentSize returns function to change satellite max segment size value.
var ReconfigureRS = func(minThreshold, repairThreshold, successThreshold, totalThreshold int) func(log *zap.Logger, index int, config *satellite.Config) { return func(log *zap.Logger, index int, config *satellite.Config) { config.Metainfo.RS.MinThreshold = minThreshold config.Metainfo.RS.RepairThreshold = repairThreshold config.Metainfo.RS.SuccessThreshold = successThreshold config.Metainfo.RS.TotalThreshold = totalThreshold } }
ReconfigureRS returns function to change satellite redundancy scheme values.
var ShortenOnlineWindow = Reconfigure{ Satellite: func(log *zap.Logger, index int, config *satellite.Config) { config.Overlay.Node.OnlineWindow = 1 * time.Second }, }
ShortenOnlineWindow returns a `Reconfigure` that sets the NodeSelection OnlineWindow to 1 second, meaning a connection failure leads to marking the nodes as offline.
Functions ¶
Types ¶
type Config ¶
type Config struct { SatelliteCount int StorageNodeCount int UplinkCount int IdentityVersion *storj.IDVersion Reconfigure Reconfigure Name string NonParallel bool }
Config describes planet configuration.
type DatabaseConfig ¶ added in v1.1.1
DatabaseConfig defines connection strings for database.
type DefaultReferralManagerServer ¶ added in v0.27.0
type DefaultReferralManagerServer struct {
// contains filtered or unexported fields
}
DefaultReferralManagerServer implements the default behavior of a mock referral manager.
func (*DefaultReferralManagerServer) GetTokens ¶ added in v0.27.0
func (server *DefaultReferralManagerServer) GetTokens(ctx context.Context, req *pb.GetTokensRequest) (*pb.GetTokensResponse, error)
GetTokens implements a mock GetTokens endpoint that returns a number of referral tokens. By default, it returns 0 tokens.
func (*DefaultReferralManagerServer) RedeemToken ¶ added in v0.27.0
func (server *DefaultReferralManagerServer) RedeemToken(ctx context.Context, req *pb.RedeemTokenRequest) (*pb.RedeemTokenResponse, error)
RedeemToken implements a mock RedeemToken endpoint.
func (*DefaultReferralManagerServer) SetTokenCount ¶ added in v0.27.0
func (server *DefaultReferralManagerServer) SetTokenCount(tokenCount int)
SetTokenCount sets the number of tokens GetTokens endpoint should return.
type Peer ¶
type Peer interface { ID() storj.NodeID Addr() string URL() string NodeURL() storj.NodeURL Run(context.Context) error Close() error }
Peer represents one of StorageNode or Satellite.
type Planet ¶
type Planet struct { VersionControl *versioncontrol.Peer Satellites []*Satellite StorageNodes []*StorageNode Uplinks []*Uplink ReferralManager *server.Server // contains filtered or unexported fields }
Planet is a full storj system setup.
func NewCustom ¶
func NewCustom(log *zap.Logger, config Config, satelliteDatabases satellitedbtest.SatelliteDatabases) (*Planet, error)
NewCustom creates a new full system with the specified configuration.
func (*Planet) FindNode ¶ added in v0.35.2
func (planet *Planet) FindNode(nodeID storj.NodeID) *StorageNode
FindNode is a helper to retrieve a storage node record by its node ID.
func (*Planet) Identities ¶
func (planet *Planet) Identities() *testidentity.Identities
Identities returns the identity provider for this planet.
func (*Planet) NewIdentity ¶
func (planet *Planet) NewIdentity() (*identity.FullIdentity, error)
NewIdentity creates a new identity for a node.
func (*Planet) NewListener ¶
NewListener creates a new listener.
func (*Planet) NewVersionConfig ¶
NewVersionConfig returns the Version Config for this planet with tuned metrics.
func (*Planet) NewVersionInfo ¶
NewVersionInfo returns the Version Info for this planet with tuned metrics.
func (*Planet) StopNodeAndUpdate ¶ added in v1.5.2
func (planet *Planet) StopNodeAndUpdate(ctx context.Context, node *StorageNode) error
StopNodeAndUpdate stops storage node and updates satellite overlay.
func (*Planet) WaitForStorageNodeDeleters ¶ added in v1.4.1
WaitForStorageNodeDeleters calls the Wait method on each storagenode's PieceDeleter.
func (*Planet) WaitForStorageNodeEndpoints ¶ added in v0.35.2
WaitForStorageNodeEndpoints waits for storage node endpoints to finish their work. The call will return an error if they have not been completed after 1 minute.
type Project ¶ added in v1.3.2
type Project struct { ID uuid.UUID Owner ProjectOwner Satellite Peer APIKey string RawAPIKey *macaroon.APIKey // contains filtered or unexported fields }
Project contains all necessary information about a user.
type ProjectOwner ¶ added in v1.3.2
ProjectOwner contains information about the project owner.
type Reconfigure ¶
type Reconfigure struct { SatelliteDB func(log *zap.Logger, index int, db satellite.DB) (satellite.DB, error) SatellitePointerDB func(log *zap.Logger, index int, db metainfo.PointerDB) (metainfo.PointerDB, error) Satellite func(log *zap.Logger, index int, config *satellite.Config) ReferralManagerServer func(log *zap.Logger) pb.DRPCReferralManagerServer StorageNodeDB func(index int, db storagenode.DB, log *zap.Logger) (storagenode.DB, error) StorageNode func(index int, config *storagenode.Config) UniqueIPCount int VersionControl func(config *versioncontrol.Config) Identities func(log *zap.Logger, version storj.IDVersion) *testidentity.Identities }
Reconfigure allows to change node configurations.
type Satellite ¶ added in v1.1.1
type Satellite struct { Config satellite.Config Core *satellite.Core API *satellite.API Repairer *satellite.Repairer Admin *satellite.Admin GC *satellite.GarbageCollection Log *zap.Logger Identity *identity.FullIdentity DB satellite.DB Dialer rpc.Dialer Server *server.Server Version *versionchecker.Service Contact struct { Service *contact.Service Endpoint *contact.Endpoint } Overlay struct { DB overlay.DB Service *overlay.Service Inspector *overlay.Inspector } Metainfo struct { Database metainfo.PointerDB Service *metainfo.Service Endpoint2 *metainfo.Endpoint Loop *metainfo.Loop } Inspector struct { Endpoint *inspector.Endpoint } Orders struct { DB orders.DB Endpoint *orders.Endpoint Service *orders.Service Chore *orders.Chore } Repair struct { Checker *checker.Checker Repairer *repairer.Service Inspector *irreparable.Inspector } Audit struct { Queues *audit.Queues Worker *audit.Worker Chore *audit.Chore Verifier *audit.Verifier Reporter *audit.Reporter } GarbageCollection struct { Service *gc.Service } ExpiredDeletion struct { Chore *expireddeletion.Chore } DBCleanup struct { Chore *dbcleanup.Chore } Accounting struct { Tally *tally.Service Rollup *rollup.Service ProjectUsage *accounting.Service ReportedRollup *reportedrollup.Chore ProjectBWCleanup *projectbwcleanup.Chore } LiveAccounting struct { Cache accounting.Cache } Mail struct { Service *mailservice.Service } Console struct { Listener net.Listener Service *console.Service Endpoint *consoleweb.Server } Marketing struct { Listener net.Listener Endpoint *marketingweb.Server } NodeStats struct { Endpoint *nodestats.Endpoint } GracefulExit struct { Chore *gracefulexit.Chore Endpoint *gracefulexit.Endpoint } Metrics struct { Chore *metrics.Chore } DowntimeTracking struct { DetectionChore *downtime.DetectionChore EstimationChore *downtime.EstimationChore Service *downtime.Service } }
Satellite contains all the processes needed to run a full Satellite setup.
func (*Satellite) AddProject ¶ added in v1.6.1
func (system *Satellite) AddProject(ctx context.Context, ownerID uuid.UUID, name string) (*console.Project, error)
AddProject adds project to a satellite and makes specified user an owner.
func (*Satellite) AddUser ¶ added in v1.6.1
func (system *Satellite) AddUser(ctx context.Context, newUser console.CreateUser, maxNumberOfProjects int) (*console.User, error)
AddUser adds user to a satellite. Password from newUser will be always overridden by FullName to have known password which can be used automatically.
func (*Satellite) Addr ¶ added in v1.1.1
Addr returns the public address from the Satellite system API.
func (*Satellite) AuthenticatedContext ¶ added in v1.11.1
func (system *Satellite) AuthenticatedContext(ctx context.Context, userID uuid.UUID) (context.Context, error)
AuthenticatedContext creates context with authentication date for given user.
func (*Satellite) NodeURL ¶ added in v1.3.2
NodeURL returns the storj.NodeURL from the Satellite system API.
func (*Satellite) PrivateAddr ¶ added in v1.1.1
PrivateAddr returns the private address from the Satellite system API.
type StorageNode ¶ added in v1.1.1
type StorageNode struct { Config storagenode.Config *storagenode.Peer }
StorageNode contains all the processes needed to run a full StorageNode setup.
func (*StorageNode) NodeURL ¶ added in v1.3.2
func (system *StorageNode) NodeURL() storj.NodeURL
NodeURL returns the storj.NodeURL.
func (*StorageNode) URL ¶ added in v1.1.1
func (system *StorageNode) URL() string
URL returns the node url as a string.
type Uplink ¶
type Uplink struct { Log *zap.Logger Identity *identity.FullIdentity Dialer rpc.Dialer Config uplink.Config APIKey map[storj.NodeID]*macaroon.APIKey Access map[storj.NodeID]*uplink.Access // Projects is indexed by the satellite number. Projects []*Project }
Uplink is a registered user on all satellites, which contains the necessary accesses and project info.
func (*Uplink) CreateBucket ¶
func (client *Uplink) CreateBucket(ctx context.Context, satellite *Satellite, bucketName string) error
CreateBucket creates a new bucket.
func (*Uplink) DeleteBucket ¶ added in v0.33.2
func (client *Uplink) DeleteBucket(ctx context.Context, satellite *Satellite, bucketName string) error
DeleteBucket deletes a bucket.
func (*Uplink) DeleteObject ¶ added in v0.33.2
func (client *Uplink) DeleteObject(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path) error
DeleteObject deletes an object at the path in a bucket.
func (*Uplink) DialMetainfo ¶
func (client *Uplink) DialMetainfo(ctx context.Context, destination Peer, apikey *macaroon.APIKey) (*metainfo.Client, error)
DialMetainfo dials destination with apikey and returns metainfo Client.
func (*Uplink) DialPiecestore ¶
func (client *Uplink) DialPiecestore(ctx context.Context, destination Peer) (*piecestore.Client, error)
DialPiecestore dials destination storagenode and returns a piecestore client.
func (*Uplink) Download ¶
func (client *Uplink) Download(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path) ([]byte, error)
Download data from specific satellite.
func (*Uplink) DownloadStream ¶
func (client *Uplink) DownloadStream(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path) (_ io.ReadCloser, cleanup func() error, err error)
DownloadStream returns stream for downloading data.
func (*Uplink) DownloadStreamRange ¶
func (client *Uplink) DownloadStreamRange(ctx context.Context, satellite *Satellite, bucketName string, path storj.Path, start, limit int64) (_ io.ReadCloser, cleanup func() error, err error)
DownloadStreamRange returns stream for downloading data.
func (*Uplink) GetProject ¶
func (client *Uplink) GetProject(ctx context.Context, satellite *Satellite) (*uplink.Project, error)
GetProject returns a uplink.Project which allows interactions with a specific project.