Documentation ¶
Index ¶
- Variables
- func QueryAccountAs[T protocol.Account](h *Harness, scope *url.URL) T
- func Txn(id *url.TxID) *condTxn
- type BlockStep
- type Condition
- type EnvelopeBuilder
- type Harness
- func (h *Harness) BuildAndSubmit(b EnvelopeBuilder) *protocol.TransactionStatus
- func (h *Harness) BuildAndSubmitSuccessfully(b EnvelopeBuilder) *protocol.TransactionStatus
- func (h *Harness) NetworkStatus(opts api.NetworkStatusOptions) *api.NetworkStatus
- func (h *Harness) Query() api.Querier2
- func (h *Harness) QueryAccount(scope *url.URL, query *api.DefaultQuery) *api.AccountRecord
- func (h *Harness) QueryAccountAs(scope *url.URL, query *api.DefaultQuery, target any) *api.AccountRecord
- func (h *Harness) QueryChain(scope *url.URL, query *api.ChainQuery) *api.ChainRecord
- func (h *Harness) QueryChainEntries(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainEntryRecord[api.Record]]
- func (h *Harness) QueryChainEntry(scope *url.URL, query *api.ChainQuery) *api.ChainEntryRecord[api.Record]
- func (h *Harness) QueryChains(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainRecord]
- func (h *Harness) QueryDataEntries(scope *url.URL, query *api.DataQuery) *api.RecordRange[*api.ChainEntryRecord[*api.TransactionRecord]]
- func (h *Harness) QueryDataEntry(scope *url.URL, query *api.DataQuery) *api.ChainEntryRecord[*api.TransactionRecord]
- func (h *Harness) QueryDirectory(scope *url.URL, query *api.DirectoryQuery) *api.RecordRange[*api.AccountRecord]
- func (h *Harness) QueryDirectoryUrls(scope *url.URL, query *api.DirectoryQuery) *api.RecordRange[*api.UrlRecord]
- func (h *Harness) QueryIdxChainEntries(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainEntryRecord[*api.IndexEntryRecord]]
- func (h *Harness) QueryIdxChainEntry(scope *url.URL, query *api.ChainQuery) *api.ChainEntryRecord[*api.IndexEntryRecord]
- func (h *Harness) QueryMajorBlock(scope *url.URL, query *api.BlockQuery) *api.MajorBlockRecord
- func (h *Harness) QueryMajorBlocks(scope *url.URL, query *api.BlockQuery) *api.RecordRange[*api.MajorBlockRecord]
- func (h *Harness) QueryMinorBlock(scope *url.URL, query *api.BlockQuery) *api.MinorBlockRecord
- func (h *Harness) QueryMinorBlocks(scope *url.URL, query *api.BlockQuery) *api.RecordRange[*api.MinorBlockRecord]
- func (h *Harness) QueryPending(scope *url.URL, query *api.PendingQuery) *api.RecordRange[*api.TransactionRecord]
- func (h *Harness) QueryPendingIds(scope *url.URL, query *api.PendingQuery) *api.RecordRange[*api.TxIDRecord]
- func (h *Harness) QuerySigChainEntries(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainEntryRecord[*api.SignatureRecord]]
- func (h *Harness) QuerySigChainEntry(scope *url.URL, query *api.ChainQuery) *api.ChainEntryRecord[*api.SignatureRecord]
- func (h *Harness) QueryTransaction(txid *url.TxID, query *api.DefaultQuery) *api.TransactionRecord
- func (h *Harness) QueryTxnChainEntries(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainEntryRecord[*api.TransactionRecord]]
- func (h *Harness) QueryTxnChainEntry(scope *url.URL, query *api.ChainQuery) *api.ChainEntryRecord[*api.TransactionRecord]
- func (h *Harness) SearchForAnchor(scope *url.URL, search *api.AnchorSearchQuery) *api.RecordRange[*api.ChainEntryRecord[api.Record]]
- func (h *Harness) SearchForDelegate(scope *url.URL, search *api.DelegateSearchQuery) *api.RecordRange[*api.KeyRecord]
- func (h *Harness) SearchForPublicKey(scope *url.URL, search *api.PublicKeySearchQuery) *api.RecordRange[*api.KeyRecord]
- func (h *Harness) SearchForPublicKeyHash(scope *url.URL, search *api.PublicKeyHashSearchQuery) *api.RecordRange[*api.KeyRecord]
- func (h *Harness) SearchForTransactionHash(scope *url.URL, search *api.TransactionHashSearchQuery) *api.RecordRange[*api.TxIDRecord]
- func (h *Harness) Step()
- func (h *Harness) StepN(n int)
- func (h *Harness) StepUntil(conditions ...Condition)
- func (h *Harness) Submit(delivery *chain.Delivery) *protocol.TransactionStatus
- func (h *Harness) SubmitSuccessfully(delivery *chain.Delivery) *protocol.TransactionStatus
- type Services
- type Sim
- func (s *Sim) Database(partition string) database.Updater
- func (s *Sim) DatabaseFor(account *url.URL) database.Updater
- func (s *Sim) Partitions() []*protocol.PartitionInfo
- func (s *Sim) Router() routing.Router
- func (s *Sim) SetRoute(account *url.URL, partition string)
- func (s *Sim) SetSubmitHook(partition string, fn simulator.SubmitHookFunc)
- func (s *Sim) SignWithNode(partition string, i int) signing.Signer
- func (s *Sim) SubmitTo(partition string, delivery *chain.Delivery) (*protocol.TransactionStatus, error)
- type Stepper
- type TimeStep
Constants ¶
This section is empty.
Variables ¶
var GenesisTime = time.Date(2022, 7, 1, 0, 0, 0, 0, time.UTC)
GenesisTime is 2022-7-1 0:00 UTC.
Functions ¶
func QueryAccountAs ¶
QueryAccountAs calls Harness.QueryAccountAs with a new T and returns that value.
Types ¶
type BlockStep ¶
type BlockStep <-chan api.Event
BlockStep implements Stepper by waiting for a block event.
type Condition ¶
A Condition is a function that is used by Harness.StepUntil to wait until some condition is met.
type EnvelopeBuilder ¶
EnvelopeBuilder builds an envelope.
type Harness ¶
Harness is a test harness.
func (*Harness) BuildAndSubmit ¶
func (h *Harness) BuildAndSubmit(b EnvelopeBuilder) *protocol.TransactionStatus
BuildAndSubmit calls the envelope builder and submits the envelope.
func (*Harness) BuildAndSubmitSuccessfully ¶
func (h *Harness) BuildAndSubmitSuccessfully(b EnvelopeBuilder) *protocol.TransactionStatus
BuildAndSubmitSuccessfully calls the envelope builder and submits the envelope. BuildAndSubmitSuccessfully fails if the transaction failed.
func (*Harness) NetworkStatus ¶
func (h *Harness) NetworkStatus(opts api.NetworkStatusOptions) *api.NetworkStatus
NetworkStatus calls the Harness's service, failing if the call returns an error.
func (*Harness) Query ¶
func (h *Harness) Query() api.Querier2
Query returns the Harness's service as an api.Querier2.
func (*Harness) QueryAccount ¶
QueryAccount queries the Harness's service, passing the given arguments. QueryAccount fails if Query returns an error. See api.Querier2.QueryAccount.
func (*Harness) QueryAccountAs ¶
func (h *Harness) QueryAccountAs(scope *url.URL, query *api.DefaultQuery, target any) *api.AccountRecord
QueryAccountAs queries the Harness's service, passing the given arguments. QueryAccountAs fails if Query returns an error. See api.Querier2.QueryAccountAs.
func (*Harness) QueryChain ¶
QueryChain queries the Harness's service, passing the given arguments. QueryChain fails if Query returns an error. See api.Querier2.QueryChain.
func (*Harness) QueryChainEntries ¶
func (h *Harness) QueryChainEntries(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainEntryRecord[api.Record]]
QueryChainEntries queries the Harness's service, passing the given arguments. QueryChainEntries fails if Query returns an error. See api.Querier2.QueryChainEntries.
func (*Harness) QueryChainEntry ¶
func (h *Harness) QueryChainEntry(scope *url.URL, query *api.ChainQuery) *api.ChainEntryRecord[api.Record]
QueryChainEntry queries the Harness's service, passing the given arguments. QueryChainEntry fails if Query returns an error. See api.Querier2.QueryChainEntry.
func (*Harness) QueryChains ¶
func (h *Harness) QueryChains(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainRecord]
QueryChains queries the Harness's service, passing the given arguments. QueryChains fails if Query returns an error. See api.Querier2.QueryChains.
func (*Harness) QueryDataEntries ¶
func (h *Harness) QueryDataEntries(scope *url.URL, query *api.DataQuery) *api.RecordRange[*api.ChainEntryRecord[*api.TransactionRecord]]
QueryDataEntries queries the Harness's service, passing the given arguments. QueryDataEntries fails if Query returns an error. See api.Querier2.QueryDataEntries.
func (*Harness) QueryDataEntry ¶
func (h *Harness) QueryDataEntry(scope *url.URL, query *api.DataQuery) *api.ChainEntryRecord[*api.TransactionRecord]
QueryDataEntry queries the Harness's service, passing the given arguments. QueryDataEntry fails if Query returns an error. See api.Querier2.QueryDataEntry.
func (*Harness) QueryDirectory ¶
func (h *Harness) QueryDirectory(scope *url.URL, query *api.DirectoryQuery) *api.RecordRange[*api.AccountRecord]
QueryDirectory queries the Harness's service, passing the given arguments. QueryDirectory fails if Query returns an error. See api.Querier2.QueryDirectory.
func (*Harness) QueryDirectoryUrls ¶
func (h *Harness) QueryDirectoryUrls(scope *url.URL, query *api.DirectoryQuery) *api.RecordRange[*api.UrlRecord]
QueryDirectoryUrls queries the Harness's service, passing the given arguments. QueryDirectoryUrls fails if Query returns an error. See api.Querier2.QueryDirectoryUrls.
func (*Harness) QueryIdxChainEntries ¶
func (h *Harness) QueryIdxChainEntries(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainEntryRecord[*api.IndexEntryRecord]]
QueryIdxChainEntries queries the Harness's service, passing the given arguments. QueryIdxChainEntries fails if Query returns an error. See api.Querier2.QueryIdxChainEntries.
func (*Harness) QueryIdxChainEntry ¶
func (h *Harness) QueryIdxChainEntry(scope *url.URL, query *api.ChainQuery) *api.ChainEntryRecord[*api.IndexEntryRecord]
QueryIdxChainEntry queries the Harness's service, passing the given arguments. QueryIdxChainEntry fails if Query returns an error. See api.Querier2.QueryIdxChainEntry.
func (*Harness) QueryMajorBlock ¶
QueryMajorBlock queries the Harness's service, passing the given arguments. QueryMajorBlock fails if Query returns an error. See api.Querier2.QueryMajorBlock.
func (*Harness) QueryMajorBlocks ¶
func (h *Harness) QueryMajorBlocks(scope *url.URL, query *api.BlockQuery) *api.RecordRange[*api.MajorBlockRecord]
QueryMajorBlocks queries the Harness's service, passing the given arguments. QueryMajorBlocks fails if Query returns an error. See api.Querier2.QueryMajorBlocks.
func (*Harness) QueryMinorBlock ¶
QueryMinorBlock queries the Harness's service, passing the given arguments. QueryMinorBlock fails if Query returns an error. See api.Querier2.QueryMinorBlock.
func (*Harness) QueryMinorBlocks ¶
func (h *Harness) QueryMinorBlocks(scope *url.URL, query *api.BlockQuery) *api.RecordRange[*api.MinorBlockRecord]
QueryMinorBlocks queries the Harness's service, passing the given arguments. QueryMinorBlocks fails if Query returns an error. See api.Querier2.QueryMinorBlocks.
func (*Harness) QueryPending ¶
func (h *Harness) QueryPending(scope *url.URL, query *api.PendingQuery) *api.RecordRange[*api.TransactionRecord]
QueryPending queries the Harness's service, passing the given arguments. QueryPending fails if Query returns an error. See api.Querier2.QueryPending.
func (*Harness) QueryPendingIds ¶
func (h *Harness) QueryPendingIds(scope *url.URL, query *api.PendingQuery) *api.RecordRange[*api.TxIDRecord]
QueryPendingIds queries the Harness's service, passing the given arguments. QueryPendingIds fails if Query returns an error. See api.Querier2.QueryPendingIds.
func (*Harness) QuerySigChainEntries ¶
func (h *Harness) QuerySigChainEntries(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainEntryRecord[*api.SignatureRecord]]
QuerySigChainEntries queries the Harness's service, passing the given arguments. QuerySigChainEntries fails if Query returns an error. See api.Querier2.QuerySigChainEntries.
func (*Harness) QuerySigChainEntry ¶
func (h *Harness) QuerySigChainEntry(scope *url.URL, query *api.ChainQuery) *api.ChainEntryRecord[*api.SignatureRecord]
QuerySigChainEntry queries the Harness's service, passing the given arguments. QuerySigChainEntry fails if Query returns an error. See api.Querier2.QuerySigChainEntry.
func (*Harness) QueryTransaction ¶
QueryTransaction queries the Harness's service, passing the given arguments. QueryTransaction fails if Query returns an error. See api.Querier2.QueryTransaction.
func (*Harness) QueryTxnChainEntries ¶
func (h *Harness) QueryTxnChainEntries(scope *url.URL, query *api.ChainQuery) *api.RecordRange[*api.ChainEntryRecord[*api.TransactionRecord]]
QueryTxnChainEntries queries the Harness's service, passing the given arguments. QueryTxnChainEntries fails if Query returns an error. See api.Querier2.QueryTxnChainEntries.
func (*Harness) QueryTxnChainEntry ¶
func (h *Harness) QueryTxnChainEntry(scope *url.URL, query *api.ChainQuery) *api.ChainEntryRecord[*api.TransactionRecord]
QueryTxnChainEntry queries the Harness's service, passing the given arguments. QueryTxnChainEntry fails if Query returns an error. See api.Querier2.QueryTxnChainEntry.
func (*Harness) SearchForAnchor ¶
func (h *Harness) SearchForAnchor(scope *url.URL, search *api.AnchorSearchQuery) *api.RecordRange[*api.ChainEntryRecord[api.Record]]
SearchForAnchor queries the Harness's service, passing the given arguments. SearchForAnchor fails if Query returns an error. See api.Querier2.SearchForAnchor.
func (*Harness) SearchForDelegate ¶
func (h *Harness) SearchForDelegate(scope *url.URL, search *api.DelegateSearchQuery) *api.RecordRange[*api.KeyRecord]
SearchForDelegate queries the Harness's service, passing the given arguments. SearchForDelegate fails if Query returns an error. See api.Querier2.SearchForDelegate.
func (*Harness) SearchForPublicKey ¶
func (h *Harness) SearchForPublicKey(scope *url.URL, search *api.PublicKeySearchQuery) *api.RecordRange[*api.KeyRecord]
SearchForPublicKey queries the Harness's service, passing the given arguments. SearchForPublicKey fails if Query returns an error. See api.Querier2.SearchForPublicKey.
func (*Harness) SearchForPublicKeyHash ¶
func (h *Harness) SearchForPublicKeyHash(scope *url.URL, search *api.PublicKeyHashSearchQuery) *api.RecordRange[*api.KeyRecord]
SearchForPublicKeyHash queries the Harness's service, passing the given arguments. SearchForPublicKeyHash fails if Query returns an error. See api.Querier2.SearchForPublicKeyHash.
func (*Harness) SearchForTransactionHash ¶
func (h *Harness) SearchForTransactionHash(scope *url.URL, search *api.TransactionHashSearchQuery) *api.RecordRange[*api.TxIDRecord]
SearchForTransactionHash queries the Harness's service, passing the given arguments. SearchForTransactionHash fails if Query returns an error. See api.Querier2.SearchForTransactionHash.
func (*Harness) StepUntil ¶
StepUntil calls the stepper until all conditions are met. StepUntil fails if the conditions are not met within 50 steps.
func (*Harness) Submit ¶
func (h *Harness) Submit(delivery *chain.Delivery) *protocol.TransactionStatus
Submit submits a delivery and returns the status.
func (*Harness) SubmitSuccessfully ¶
func (h *Harness) SubmitSuccessfully(delivery *chain.Delivery) *protocol.TransactionStatus
SubmitSuccessfully submits a delivery and returns the status. SubmitSuccessfully fails if the transaction failed.
type Services ¶
type Services interface { api.Querier api.Submitter api.NetworkService }
Services defines the services required by the harness.
type Sim ¶
type Sim struct { Harness // contains filtered or unexported fields }
Sim is a Harness with some extra simulator-specific features.
func NewSim ¶
func NewSim(tb testing.TB, database simulator.OpenDatabaseFunc, init *accumulated.NetworkInit, snapshot simulator.SnapshotFunc) *Sim
NewSim creates a simulator with the given database, network initialization, and snapshot function and calls NewSimWith.
func NewSimWith ¶
NewSimWith creates a Harness for the given simulator instance and wraps it as a Sim.
func (*Sim) DatabaseFor ¶
DatabaseFor calls Simulator.DatabaseFor.
func (*Sim) Partitions ¶
func (s *Sim) Partitions() []*protocol.PartitionInfo
Partitions calls Simulator.Partitions.
func (*Sim) SetSubmitHook ¶
func (s *Sim) SetSubmitHook(partition string, fn simulator.SubmitHookFunc)
SetSubmitHook calls Simulator.SetSubmitHook.
func (*Sim) SignWithNode ¶
SignWithNode calls Simulator.SignWithNode.