Documentation
¶
Overview ¶
Package testutil provides shared test infrastructure for SynapS3 packages. It is only compiled and linked in test binaries.
Index ¶
- Constants
- Variables
- func AddQueryHook(db *bun.DB, hook bun.QueryHook)
- func CommitExtraData(nonce uint64) []byte
- func CommitExtraDataHex(nonce uint64) string
- func CommitStorageCopy(t *testing.T, db bun.IDB, _ *repository.Repositories, input CommitCopyInput)
- func DefaultWalletExecutionIdentity() walletoperation.ExecutionIdentity
- func FailWrites(tb testing.TB, db bun.IDB, table, event, when, message string) func()
- func JSONEqual(a, b []byte) bool
- func NewTestDB(t *testing.T) *bun.DB
- func NewTestRepos(t *testing.T) *repository.Repositories
- func OpenBucketReplicaSlots(tb testing.TB, db bun.IDB, bucketID int64, copies int)
- func SeedBucket(t *testing.T, db *bun.DB, name string) *model.Bucket
- func SeedBucketWithCopies(t *testing.T, db *bun.DB, name string, status model.BucketStatus, copies int) *model.Bucket
- func SeedBucketWithStatus(t *testing.T, db *bun.DB, name string, status model.BucketStatus) *model.Bucket
- func StorageChecksum(identity string) string
- type CommitCopyInput
- type MockCache
- func (m *MockCache) AssemblePartsStaged(ctx context.Context, bucket, key, uploadID string, partNumbers []int) (*cache.StagedObject, []string, error)
- func (m *MockCache) CapacitySnapshot() cache.CapacitySnapshot
- func (m *MockCache) ConsumeRefusedWriteBytes() int64
- func (m *MockCache) CreateBucketDir(ctx context.Context, bucket string) error
- func (m *MockCache) Delete(ctx context.Context, bucket, key string) error
- func (m *MockCache) DeleteBucketDir(ctx context.Context, bucket string) error
- func (m *MockCache) DeleteQuarantined(ctx context.Context, bucket string, contentID int64) error
- func (m *MockCache) DeleteUpload(ctx context.Context, uploadID string) error
- func (m *MockCache) Exists(ctx context.Context, bucket, key string) bool
- func (m *MockCache) Get(ctx context.Context, bucket, key string) (io.ReadCloser, *cache.ObjectInfo, error)
- func (m *MockCache) ListUploadIDs(ctx context.Context) ([]string, error)
- func (m *MockCache) Put(ctx context.Context, bucket, key string, r io.Reader, size int64) (*cache.ObjectInfo, error)
- func (m *MockCache) PutPartStaged(ctx context.Context, uploadID string, partNumber int, r io.Reader, size int64) (*cache.StagedObject, error)
- func (m *MockCache) PutStaged(ctx context.Context, bucket, key string, r io.Reader, size int64) (*cache.StagedObject, error)
- func (m *MockCache) Quarantine(ctx context.Context, bucket string, contentID int64) error
- func (m *MockCache) UsedBytes() int64
- func (m *MockCache) WalkContentFiles(ctx context.Context, quarantined bool, visit func(string, int64) error) error
- type MockChainEpochReader
- type MockCommitNonces
- func (m *MockCommitNonces) ClientNonce(_ context.Context, nonce sdktypes.BigInt) (synapse.ClientNonceState, error)
- func (m *MockCommitNonces) Consume(nonce uint64, dataSetID, pieceID sdktypes.BigInt, pieceCID cid.Cid)
- func (m *MockCommitNonces) ConsumeExtraData(extraData []byte, dataSetID, pieceID sdktypes.BigInt, pieceCID cid.Cid)
- func (m *MockCommitNonces) ConsumeRequest(extraData []byte, dataSetID, firstPieceID sdktypes.BigInt, pieceCIDs []cid.Cid)
- func (m *MockCommitNonces) PieceCIDAt(_ context.Context, dataSetID, pieceID sdktypes.BigInt) (cid.Cid, error)
- func (m *MockCommitNonces) Reads() int
- type MockServiceTerminator
- func (m *MockServiceTerminator) ContextIdentity() storage.ContextIdentity
- func (m *MockServiceTerminator) PDPVerifierAddress() common.Address
- func (m *MockServiceTerminator) TerminateService(ctx context.Context, dataSetID sdktypes.BigInt, hooks synapse.TerminationHooks) (*synapse.TerminationResult, error)
- func (m *MockServiceTerminator) VerifyServicePayer(ctx context.Context, dataSetID sdktypes.BigInt) error
- type MockStorageClient
- func (m *MockStorageClient) ContextIdentity() storage.ContextIdentity
- func (m *MockStorageClient) DeletionStates(ctx context.Context, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (synapse.CleanupPiecesState, error)
- func (m *MockStorageClient) Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
- func (m *MockStorageClient) FindMatchingDataSet(ctx context.Context, providerID sdktypes.BigInt, metadata map[string]string, ...) (*storage.DataSetRef, error)
- func (m *MockStorageClient) OpenCleanupContext(ctx context.Context, dataSetID sdktypes.BigInt, ...) (synapse.CleanupContext, error)
- func (m *MockStorageClient) OpenDataSetTarget(ctx context.Context, dataSetID sdktypes.BigInt, ...) (synapse.DataSetTarget, error)
- func (m *MockStorageClient) OpenProviderTarget(ctx context.Context, providerID sdktypes.BigInt, ...) (synapse.ProviderTarget, error)
- func (m *MockStorageClient) PDPVerifierAddress() common.Address
- func (m *MockStorageClient) PrepareUpload(ctx context.Context, dataSize uint64, targets []synapse.StorageTarget) (*sdkcosts.MultiContextCosts, error)
- func (m *MockStorageClient) ProviderPiecesKnown(ctx context.Context, serviceURL string, dataSetID sdktypes.BigInt, ...) (synapse.ProviderPiecesState, error)
- func (m *MockStorageClient) SelectUploadTargets(ctx context.Context, opts storage.SelectUploadContextsOptions) ([]synapse.StorageTarget, error)
- func (m *MockStorageClient) Upload(ctx context.Context, r io.Reader, opts *storage.UploadOptions) (*storage.UploadResult, error)
- type MockStorageTarget
- func (m *MockStorageTarget) CDNEnabled() bool
- func (m *MockStorageTarget) CheckWritable(ctx context.Context) error
- func (m *MockStorageTarget) ClientDataSetID() sdktypes.BigInt
- func (m *MockStorageTarget) ContextIdentity() storage.ContextIdentity
- func (m *MockStorageTarget) CreateDataSet(ctx context.Context, opts *storage.CreateDataSetOptions) (*storage.CreateDataSetResult, error)
- func (m *MockStorageTarget) CreateStoreSession(ctx context.Context) (string, error)
- func (m *MockStorageTarget) DataSetRef() (storage.DataSetRef, bool)
- func (m *MockStorageTarget) FinalizeStoreSession(ctx context.Context, serviceURL, sessionID string, pieceCID cid.Cid) error
- func (m *MockStorageTarget) FindDataSetByClientDataSetID(ctx context.Context, clientDataSetID sdktypes.BigInt) (storage.DataSetRef, bool, error)
- func (m *MockStorageTarget) GetCommitStatus(ctx context.Context, statusURL string) (*storage.CommitStatus, error)
- func (m *MockStorageTarget) GetProviderInfo() storage.Provider
- func (m *MockStorageTarget) PieceStatus(ctx context.Context, pieceCID cid.Cid) (*storage.PieceStatus, error)
- func (m *MockStorageTarget) PieceURL(piece cid.Cid) string
- func (m *MockStorageTarget) PresignForCommit(ctx context.Context, pieces []storage.PieceInput) ([]byte, error)
- func (m *MockStorageTarget) ProviderID() sdktypes.BigInt
- func (m *MockStorageTarget) ServiceURL() string
- func (m *MockStorageTarget) SubmitCommit(ctx context.Context, request storage.CommitRequest) (*storage.CommitSubmission, error)
- func (m *MockStorageTarget) SubmitPull(ctx context.Context, request storage.PullRequest) (*storage.PullResult, error)
- func (m *MockStorageTarget) UploadStoreSession(ctx context.Context, serviceURL, sessionID string, reader io.Reader, ...) (*storage.StoreResult, error)
- func (m *MockStorageTarget) WaitForDataSetCreated(ctx context.Context, statusURL string, clientDataSetID sdktypes.BigInt) (*storage.CreateDataSetResult, error)
- type MockWalletQuerier
- type OpenTargetOptions
Constants ¶
const ( TaskPollInterval = 25 * time.Millisecond TaskLeaseDuration = 5 * time.Second )
Business-flow tests leave enough lease time for transactional settlement under load.
Variables ¶
var ( DefaultPDPVerifierAddress = common.HexToAddress("0x00000000000000000000000000000000000000c3") DefaultPaymentsAddress = common.HexToAddress("0x00000000000000000000000000000000000000d4") DefaultUSDFCAddress = common.HexToAddress("0x00000000000000000000000000000000000000e5") )
var DefaultContextIdentity = storage.ContextIdentity{ Payer: common.HexToAddress("0x00000000000000000000000000000000000000a1"), ChainID: 314159, RecordKeeper: common.HexToAddress("0x00000000000000000000000000000000000000b2"), }
DefaultContextIdentity is the signing identity mock targets report unless a test sets ContextIdentityValue.
Functions ¶
func AddQueryHook ¶
AddQueryHook attaches hook to db in place. Tests use it to observe or pause the queries of components that already hold db; bun's WithQueryHook returns a copy those components never see.
func CommitExtraData ¶
CommitExtraData encodes add-pieces extra data signed with nonce, the shape a storage commit reads its nonce from.
func CommitExtraDataHex ¶
CommitExtraDataHex is CommitExtraData as the lowercase hex a copy stores.
func CommitStorageCopy ¶
func CommitStorageCopy(t *testing.T, db bun.IDB, _ *repository.Repositories, input CommitCopyInput)
CommitStorageCopy commits one copy the way a confirmed registration leaves it: a confirmed single-piece request is recorded first, and the copy then names it. A committed copy without a confirmed request is refused by the schema, so tests cannot shortcut this.
func DefaultWalletExecutionIdentity ¶
func DefaultWalletExecutionIdentity() walletoperation.ExecutionIdentity
func FailWrites ¶
FailWrites makes matching row writes to table fail with message, to inject a database failure at one statement. event is a trigger event such as "INSERT" or "UPDATE OF status"; when, if not empty, is a condition over NEW and OLD. The returned function removes the fault.
func JSONEqual ¶
JSONEqual reports whether a and b hold the same JSON value; two absent values are equal. PostgreSQL stores jsonb normalized, so a value read back need not repeat the bytes written.
func NewTestDB ¶
NewTestDB clones this process's migrated template into a private database. Its connections close and the database is dropped when the test completes.
func NewTestRepos ¶
func NewTestRepos(t *testing.T) *repository.Repositories
NewTestRepos creates a Repositories instance backed by NewTestDB.
func OpenBucketReplicaSlots ¶
OpenBucketReplicaSlots inserts the replica slots a bucket seeded outside repository.Buckets.Create would otherwise be missing. Data sets, copies, replacements, cleanups and observability rows all reference these, so a test that seeds a bucket directly must open its slots too.
func SeedBucket ¶
SeedBucket inserts an active bucket and returns it.
func SeedBucketWithCopies ¶
func SeedBucketWithCopies(t *testing.T, db *bun.DB, name string, status model.BucketStatus, copies int) *model.Bucket
SeedBucketWithCopies inserts a bucket whose durability policy is the given replica target, along with the replica slots that target opens.
func SeedBucketWithStatus ¶
func SeedBucketWithStatus(t *testing.T, db *bun.DB, name string, status model.BucketStatus) *model.Bucket
SeedBucketWithStatus inserts a bucket with the specified status.
func StorageChecksum ¶
StorageChecksum turns a readable fixture identity into the canonical lowercase SHA-256 representation required by storage_contents.
Types ¶
type CommitCopyInput ¶
type CommitCopyInput struct {
StorageCopyID int64
ContentID int64
CopyIndex int
PieceCID string
PieceID *idtypes.OnChainID
RetrievalURL string
TransactionID string
}
CommitCopyInput names a copy to commit and the evidence it ends with.
type MockCache ¶
type MockCache struct {
ListUploadIDsFunc func(context.Context) ([]string, error)
WalkContentFilesFunc func(context.Context, bool, func(string, int64) error) error
QuarantineFunc func(context.Context, string, int64) error
DeleteQuarantinedFunc func(context.Context, string, int64) error
PutFunc func(ctx context.Context, bucket, key string, r io.Reader, size int64) (*cache.ObjectInfo, error)
PutStagedFunc func(ctx context.Context, bucket, key string, r io.Reader, size int64) (*cache.StagedObject, error)
GetFunc func(ctx context.Context, bucket, key string) (io.ReadCloser, *cache.ObjectInfo, error)
DeleteFunc func(ctx context.Context, bucket, key string) error
ExistsFunc func(ctx context.Context, bucket, key string) bool
UsedBytesFunc func() int64
CapacitySnapshotFunc func() cache.CapacitySnapshot
ConsumeRefusedWriteBytesFunc func() int64
CreateBucketDirFunc func(ctx context.Context, bucket string) error
DeleteBucketDirFunc func(ctx context.Context, bucket string) error
PutPartStagedFunc func(ctx context.Context, uploadID string, partNumber int, r io.Reader, size int64) (*cache.StagedObject, error)
AssemblePartsFunc func(ctx context.Context, bucket, key, uploadID string, partNumbers []int) (*cache.StagedObject, []string, error)
DeleteUploadFunc func(ctx context.Context, uploadID string) error
}
MockCache is a configurable test double for cache.Cache. Use for fault injection tests; for happy-path tests prefer real cache.NewFilesystem.
func (*MockCache) AssemblePartsStaged ¶
func (*MockCache) CapacitySnapshot ¶
func (m *MockCache) CapacitySnapshot() cache.CapacitySnapshot
func (*MockCache) ConsumeRefusedWriteBytes ¶
func (*MockCache) CreateBucketDir ¶
func (*MockCache) DeleteBucketDir ¶
func (*MockCache) DeleteQuarantined ¶ added in v0.1.1
func (*MockCache) DeleteUpload ¶
func (*MockCache) Get ¶
func (m *MockCache) Get(ctx context.Context, bucket, key string) (io.ReadCloser, *cache.ObjectInfo, error)
func (*MockCache) ListUploadIDs ¶ added in v0.1.1
func (*MockCache) PutPartStaged ¶ added in v0.1.1
func (*MockCache) Quarantine ¶ added in v0.1.1
type MockChainEpochReader ¶
MockChainEpochReader is a configurable test double for synapse.ChainEpochReader. An unconfigured reader reports epoch zero, which keeps a retirement gate waiting rather than letting it pass by accident.
func (*MockChainEpochReader) CurrentEpoch ¶
func (m *MockChainEpochReader) CurrentEpoch(ctx context.Context) (int64, error)
type MockCommitNonces ¶
type MockCommitNonces struct {
// Err fails every read while set.
Err error
// contains filtered or unexported fields
}
MockCommitNonces is chain nonce state a test sets directly.
func (*MockCommitNonces) ClientNonce ¶
func (m *MockCommitNonces) ClientNonce(_ context.Context, nonce sdktypes.BigInt) (synapse.ClientNonceState, error)
func (*MockCommitNonces) Consume ¶
func (m *MockCommitNonces) Consume(nonce uint64, dataSetID, pieceID sdktypes.BigInt, pieceCID cid.Cid)
Consume records that the request signed with nonce added pieceCID to the data set as pieceID.
func (*MockCommitNonces) ConsumeExtraData ¶
func (m *MockCommitNonces) ConsumeExtraData(extraData []byte, dataSetID, pieceID sdktypes.BigInt, pieceCID cid.Cid)
ConsumeExtraData is Consume for the nonce signed into extraData.
func (*MockCommitNonces) ConsumeRequest ¶
func (m *MockCommitNonces) ConsumeRequest(extraData []byte, dataSetID, firstPieceID sdktypes.BigInt, pieceCIDs []cid.Cid)
ConsumeRequest records that the request signed into extraData added pieceCIDs, in order, to the data set starting at firstPieceID.
func (*MockCommitNonces) PieceCIDAt ¶
func (*MockCommitNonces) Reads ¶
func (m *MockCommitNonces) Reads() int
Reads counts the nonce reads made so far.
type MockServiceTerminator ¶
type MockServiceTerminator struct {
TerminateServiceFunc func(ctx context.Context, dataSetID sdktypes.BigInt) (*synapse.TerminationResult, error)
// VerifyServicePayerFunc defaults to accepting every data set.
VerifyServicePayerFunc func(ctx context.Context, dataSetID sdktypes.BigInt) error
// ContextIdentityValue overrides DefaultContextIdentity.
ContextIdentityValue storage.ContextIdentity
}
MockServiceTerminator is a configurable test double for synapse.ServiceTerminator.
func (*MockServiceTerminator) ContextIdentity ¶
func (m *MockServiceTerminator) ContextIdentity() storage.ContextIdentity
ContextIdentity returns ContextIdentityValue, or DefaultContextIdentity when no test sets it.
func (*MockServiceTerminator) PDPVerifierAddress ¶
func (m *MockServiceTerminator) PDPVerifierAddress() common.Address
func (*MockServiceTerminator) TerminateService ¶
func (m *MockServiceTerminator) TerminateService(ctx context.Context, dataSetID sdktypes.BigInt, hooks synapse.TerminationHooks) (*synapse.TerminationResult, error)
func (*MockServiceTerminator) VerifyServicePayer ¶
func (m *MockServiceTerminator) VerifyServicePayer(ctx context.Context, dataSetID sdktypes.BigInt) error
VerifyServicePayer calls VerifyServicePayerFunc, accepting every data set when no test sets it.
type MockStorageClient ¶
type MockStorageClient struct {
ContextIdentityValue storage.ContextIdentity
PDPVerifierAddressValue common.Address
UploadFunc func(ctx context.Context, r io.Reader, opts *storage.UploadOptions) (*storage.UploadResult, error)
DownloadFunc func(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
PrepareUploadFunc func(ctx context.Context, dataSize uint64, targets []synapse.StorageTarget) (*sdkcosts.MultiContextCosts, error)
SelectUploadTargetsFunc func(ctx context.Context, opts storage.SelectUploadContextsOptions) ([]synapse.StorageTarget, error)
OpenProviderTargetFunc func(ctx context.Context, providerID sdktypes.BigInt, opts storage.NewProviderContextOptions) (synapse.ProviderTarget, error)
OpenDataSetTargetFunc func(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (synapse.DataSetTarget, error)
OpenTargetFunc func(ctx context.Context, opts *OpenTargetOptions) (synapse.StorageTarget, error)
FindMatchingDataSetFunc func(ctx context.Context, providerID sdktypes.BigInt, metadata map[string]string, withCDN bool) (*storage.DataSetRef, error)
OpenCleanupContextFunc func(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (synapse.CleanupContext, error)
DeletionStateFunc func(ctx context.Context, dataSetID, pieceID sdktypes.BigInt) (synapse.CleanupPieceState, error)
DeletionStatesFunc func(ctx context.Context, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (synapse.CleanupPiecesState, error)
ProviderPiecesKnownFunc func(ctx context.Context, serviceURL string, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (synapse.ProviderPiecesState, error)
}
MockStorageClient is a configurable test double for synapse.StorageClient.
func (*MockStorageClient) ContextIdentity ¶
func (m *MockStorageClient) ContextIdentity() storage.ContextIdentity
func (*MockStorageClient) DeletionStates ¶ added in v0.1.1
func (m *MockStorageClient) DeletionStates(ctx context.Context, dataSetID sdktypes.BigInt, pieceIDs []sdktypes.BigInt) (synapse.CleanupPiecesState, error)
func (*MockStorageClient) Download ¶
func (m *MockStorageClient) Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
func (*MockStorageClient) FindMatchingDataSet ¶
func (*MockStorageClient) OpenCleanupContext ¶
func (m *MockStorageClient) OpenCleanupContext(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (synapse.CleanupContext, error)
func (*MockStorageClient) OpenDataSetTarget ¶
func (m *MockStorageClient) OpenDataSetTarget(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (synapse.DataSetTarget, error)
func (*MockStorageClient) OpenProviderTarget ¶
func (m *MockStorageClient) OpenProviderTarget(ctx context.Context, providerID sdktypes.BigInt, opts storage.NewProviderContextOptions) (synapse.ProviderTarget, error)
func (*MockStorageClient) PDPVerifierAddress ¶
func (m *MockStorageClient) PDPVerifierAddress() common.Address
func (*MockStorageClient) PrepareUpload ¶
func (m *MockStorageClient) PrepareUpload(ctx context.Context, dataSize uint64, targets []synapse.StorageTarget) (*sdkcosts.MultiContextCosts, error)
func (*MockStorageClient) ProviderPiecesKnown ¶ added in v0.1.1
func (*MockStorageClient) SelectUploadTargets ¶
func (m *MockStorageClient) SelectUploadTargets(ctx context.Context, opts storage.SelectUploadContextsOptions) ([]synapse.StorageTarget, error)
func (*MockStorageClient) Upload ¶
func (m *MockStorageClient) Upload(ctx context.Context, r io.Reader, opts *storage.UploadOptions) (*storage.UploadResult, error)
type MockStorageTarget ¶
type MockStorageTarget struct {
ProviderIDValue sdktypes.BigInt
DataSetIDValue *sdktypes.BigInt
ClientDataSetIDValue sdktypes.BigInt
ServiceURLValue string
WithCDNValue bool
CreateDataSetFunc func(context.Context, *storage.CreateDataSetOptions) (*storage.CreateDataSetResult, error)
WaitDataSetFunc func(context.Context, string, sdktypes.BigInt) (*storage.CreateDataSetResult, error)
// ContextIdentityValue overrides DefaultContextIdentity.
ContextIdentityValue storage.ContextIdentity
FindDataSetByClientIDFunc func(context.Context, sdktypes.BigInt) (storage.DataSetRef, bool, error)
CreateStoreSessionFunc func(context.Context) (string, error)
UploadStoreSessionFunc func(context.Context, string, string, io.Reader, *storage.StoreOptions) (*storage.StoreResult, error)
FinalizeStoreSessionFunc func(context.Context, string, string, cid.Cid) error
PresignForCommitFunc func(context.Context, []storage.PieceInput) ([]byte, error)
SubmitPullFunc func(context.Context, storage.PullRequest) (*storage.PullResult, error)
SubmitCommitFunc func(context.Context, storage.CommitRequest) (*storage.CommitSubmission, error)
GetCommitStatusFunc func(context.Context, string) (*storage.CommitStatus, error)
PieceStatusFunc func(context.Context, cid.Cid) (*storage.PieceStatus, error)
// CheckWritableFunc defaults to a writable data set.
CheckWritableFunc func(context.Context) error
}
MockStorageTarget is a minimal immutable storage target for tests that only need provider metadata for upload preparation.
func NewMockDataSetTarget ¶
func NewMockDataSetTarget(providerID, dataSetID sdktypes.BigInt, withCDN *bool) *MockStorageTarget
func NewMockProviderTarget ¶
func NewMockProviderTarget(providerID sdktypes.BigInt, opts storage.NewProviderContextOptions) *MockStorageTarget
func (*MockStorageTarget) CDNEnabled ¶
func (m *MockStorageTarget) CDNEnabled() bool
func (*MockStorageTarget) CheckWritable ¶
func (m *MockStorageTarget) CheckWritable(ctx context.Context) error
func (*MockStorageTarget) ClientDataSetID ¶
func (m *MockStorageTarget) ClientDataSetID() sdktypes.BigInt
func (*MockStorageTarget) ContextIdentity ¶
func (m *MockStorageTarget) ContextIdentity() storage.ContextIdentity
func (*MockStorageTarget) CreateDataSet ¶
func (m *MockStorageTarget) CreateDataSet(ctx context.Context, opts *storage.CreateDataSetOptions) (*storage.CreateDataSetResult, error)
func (*MockStorageTarget) CreateStoreSession ¶
func (m *MockStorageTarget) CreateStoreSession(ctx context.Context) (string, error)
func (*MockStorageTarget) DataSetRef ¶
func (m *MockStorageTarget) DataSetRef() (storage.DataSetRef, bool)
func (*MockStorageTarget) FinalizeStoreSession ¶
func (*MockStorageTarget) FindDataSetByClientDataSetID ¶
func (m *MockStorageTarget) FindDataSetByClientDataSetID(ctx context.Context, clientDataSetID sdktypes.BigInt) (storage.DataSetRef, bool, error)
func (*MockStorageTarget) GetCommitStatus ¶
func (m *MockStorageTarget) GetCommitStatus(ctx context.Context, statusURL string) (*storage.CommitStatus, error)
func (*MockStorageTarget) GetProviderInfo ¶
func (m *MockStorageTarget) GetProviderInfo() storage.Provider
func (*MockStorageTarget) PieceStatus ¶
func (m *MockStorageTarget) PieceStatus(ctx context.Context, pieceCID cid.Cid) (*storage.PieceStatus, error)
func (*MockStorageTarget) PresignForCommit ¶
func (m *MockStorageTarget) PresignForCommit(ctx context.Context, pieces []storage.PieceInput) ([]byte, error)
func (*MockStorageTarget) ProviderID ¶
func (m *MockStorageTarget) ProviderID() sdktypes.BigInt
func (*MockStorageTarget) ServiceURL ¶
func (m *MockStorageTarget) ServiceURL() string
func (*MockStorageTarget) SubmitCommit ¶
func (m *MockStorageTarget) SubmitCommit(ctx context.Context, request storage.CommitRequest) (*storage.CommitSubmission, error)
func (*MockStorageTarget) SubmitPull ¶
func (m *MockStorageTarget) SubmitPull(ctx context.Context, request storage.PullRequest) (*storage.PullResult, error)
func (*MockStorageTarget) UploadStoreSession ¶
func (m *MockStorageTarget) UploadStoreSession(ctx context.Context, serviceURL, sessionID string, reader io.Reader, opts *storage.StoreOptions) (*storage.StoreResult, error)
func (*MockStorageTarget) WaitForDataSetCreated ¶
func (m *MockStorageTarget) WaitForDataSetCreated(ctx context.Context, statusURL string, clientDataSetID sdktypes.BigInt) (*storage.CreateDataSetResult, error)
type MockWalletQuerier ¶
type MockWalletQuerier struct {
GetWalletInfoFunc func(ctx context.Context) (*synapse.WalletInfo, error)
}
MockWalletQuerier is a configurable test double for synapse.WalletQuerier.
func (*MockWalletQuerier) GetWalletInfo ¶
func (m *MockWalletQuerier) GetWalletInfo(ctx context.Context) (*synapse.WalletInfo, error)
func (*MockWalletQuerier) WalletIdentity ¶
func (m *MockWalletQuerier) WalletIdentity() walletoperation.ExecutionIdentity