testsuite

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestProfileCaches = &profile.Caches{
	Addresses: &profile.CacheOpts{
		CacheTime:                  "200ms",
		ReleaseExecutorWorkerCount: 10,
		LeakDetectionOptions: &profile.LeakDetectionOpts{
			Enabled:               false,
			MaxConsumersPerObject: 20,
			MaxConsumerHoldTime:   "100s",
		},
	},
	Children: &profile.CacheOpts{
		CacheTime:                  "5s",
		ReleaseExecutorWorkerCount: 10,
		LeakDetectionOptions: &profile.LeakDetectionOpts{
			Enabled:               false,
			MaxConsumersPerObject: 20,
			MaxConsumerHoldTime:   "100s",
		},
	},
	Indexations: &profile.CacheOpts{
		CacheTime:                  "200ms",
		ReleaseExecutorWorkerCount: 10,
		LeakDetectionOptions: &profile.LeakDetectionOpts{
			Enabled:               false,
			MaxConsumersPerObject: 20,
			MaxConsumerHoldTime:   "100s",
		},
	},
	Milestones: &profile.CacheOpts{
		CacheTime:                  "2.5s",
		ReleaseExecutorWorkerCount: 10,
		LeakDetectionOptions: &profile.LeakDetectionOpts{
			Enabled:               false,
			MaxConsumersPerObject: 20,
			MaxConsumerHoldTime:   "100s",
		},
	},
	Messages: &profile.CacheOpts{
		CacheTime:                  "5s",
		ReleaseExecutorWorkerCount: 10,
		LeakDetectionOptions: &profile.LeakDetectionOpts{
			Enabled:               false,
			MaxConsumersPerObject: 20,
			MaxConsumerHoldTime:   "100s",
		},
	},
	UnreferencedMessages: &profile.CacheOpts{
		CacheTime:                  "100ms",
		ReleaseExecutorWorkerCount: 10,
		LeakDetectionOptions: &profile.LeakDetectionOpts{
			Enabled:               false,
			MaxConsumersPerObject: 20,
			MaxConsumerHoldTime:   "100s",
		},
	},
	IncomingMessagesFilter: &profile.CacheOpts{
		CacheTime:                  "2.5s",
		ReleaseExecutorWorkerCount: 10,
		LeakDetectionOptions: &profile.LeakDetectionOpts{
			Enabled:               false,
			MaxConsumersPerObject: 20,
			MaxConsumerHoldTime:   "100s",
		},
	},
}

Functions

This section is empty.

Types

type Message added in v1.0.0

type Message struct {
	// contains filtered or unexported fields
}

func (*Message) BookOnWallets added in v1.0.0

func (m *Message) BookOnWallets() *Message

func (*Message) GeneratedUTXO added in v1.0.0

func (m *Message) GeneratedUTXO() *utxo.Output

func (*Message) IotaMessage added in v1.1.0

func (m *Message) IotaMessage() *iotago.Message

func (*Message) RemainderUTXO added in v1.1.0

func (m *Message) RemainderUTXO() *utxo.Output

func (*Message) Store added in v1.0.0

func (m *Message) Store() *Message

func (*Message) StoredMessage added in v1.1.0

func (m *Message) StoredMessage() *storage.Message

func (*Message) StoredMessageID added in v1.0.0

func (m *Message) StoredMessageID() hornet.MessageID

type MessageBuilder added in v1.0.0

type MessageBuilder struct {
	// contains filtered or unexported fields
}

func (*MessageBuilder) Amount added in v1.0.0

func (b *MessageBuilder) Amount(amount uint64) *MessageBuilder

func (*MessageBuilder) Build added in v1.0.0

func (b *MessageBuilder) Build() *Message

func (*MessageBuilder) BuildIndexation added in v1.0.0

func (b *MessageBuilder) BuildIndexation() *Message

func (*MessageBuilder) DustAllowance added in v1.0.0

func (b *MessageBuilder) DustAllowance() *MessageBuilder

func (*MessageBuilder) FakeInputs added in v1.0.0

func (b *MessageBuilder) FakeInputs() *MessageBuilder

func (*MessageBuilder) FromWallet added in v1.0.0

func (b *MessageBuilder) FromWallet(wallet *utils.HDWallet) *MessageBuilder

func (*MessageBuilder) IndexationData added in v1.1.0

func (b *MessageBuilder) IndexationData(data []byte) *MessageBuilder

func (*MessageBuilder) LatestMilestonesAsParents added in v1.1.0

func (b *MessageBuilder) LatestMilestonesAsParents() *MessageBuilder

func (*MessageBuilder) Parents added in v1.0.0

func (b *MessageBuilder) Parents(parents hornet.MessageIDs) *MessageBuilder

func (*MessageBuilder) ToWallet added in v1.0.0

func (b *MessageBuilder) ToWallet(wallet *utils.HDWallet) *MessageBuilder

func (*MessageBuilder) UsingOutput added in v1.0.0

func (b *MessageBuilder) UsingOutput(output *utxo.Output) *MessageBuilder

type OnLedgerUpdatedFunc added in v1.2.0

type OnLedgerUpdatedFunc func(index milestone.Index, newOutputs utxo.Outputs, newSpents utxo.Spents)

type OnMilestoneConfirmedFunc added in v1.1.0

type OnMilestoneConfirmedFunc func(confirmation *whiteflag.Confirmation)

type TestEnvironment

type TestEnvironment struct {
	// TestInterface is the common interface for tests and benchmarks.
	TestInterface testing.TB

	// Milestones are the created milestones by the coordinator during the test.
	Milestones storage.CachedMilestones

	// PoWHandler holds the PoWHandler instance.
	PoWHandler *pow.Handler

	// LastMilestoneMessageID is the message ID of the last issued milestone.
	LastMilestoneMessageID hornet.MessageID

	// GenesisOutput marks the initial output created when bootstrapping the tangle.
	GenesisOutput *utxo.Output

	// OnMilestoneConfirmed callback that will be called at confirming a milestone. This is equivalent to the tangle.MilestoneConfirmed event.
	OnMilestoneConfirmed OnMilestoneConfirmedFunc

	// OnLedgerUpdatedFunc callback that will be called after the ledger gets updated during confirmation. This is equivalent to the tangle.LedgerUpdated event.
	OnLedgerUpdatedFunc OnLedgerUpdatedFunc
	// contains filtered or unexported fields
}

TestEnvironment holds the state of the test environment.

func SetupTestEnvironment

func SetupTestEnvironment(testInterface testing.TB, genesisAddress *iotago.Ed25519Address, numberOfMilestones int, belowMaxDepth int, targetScore float64, showConfirmationGraphs bool) *TestEnvironment

SetupTestEnvironment initializes a clean database with initial snapshot, configures a coordinator with a clean state, bootstraps the network and issues the first "numberOfMilestones" milestones.

func (*TestEnvironment) AssertLedgerBalance added in v1.1.0

func (te *TestEnvironment) AssertLedgerBalance(wallet *utils.HDWallet, expectedBalance uint64)

AssertLedgerBalance generates an address for the given seed and index and checks correct balance.

func (*TestEnvironment) AssertMessageConflictReason added in v1.0.0

func (te *TestEnvironment) AssertMessageConflictReason(messageID hornet.MessageID, conflict storage.Conflict)

func (*TestEnvironment) AssertTotalSupplyStillValid

func (te *TestEnvironment) AssertTotalSupplyStillValid()

AssertTotalSupplyStillValid checks if the total supply in the database is still correct.

func (*TestEnvironment) AssertWalletBalance added in v1.0.0

func (te *TestEnvironment) AssertWalletBalance(wallet *utils.HDWallet, expectedBalance uint64)

AssertWalletBalance generates an address for the given seed and index and checks correct balance.

func (*TestEnvironment) BelowMaxDepth added in v1.1.0

func (te *TestEnvironment) BelowMaxDepth() milestone.Index

func (*TestEnvironment) BuildTangle added in v1.0.0

func (te *TestEnvironment) BuildTangle(initMessagesCount int,
	belowMaxDepth int,
	milestonesCount int,
	minMessagesPerMilestone int,
	maxMessagesPerMilestone int,
	onNewMessage func(cmi milestone.Index, msgMeta *storage.MessageMetadata),
	milestoneTipSelectFunc func(messages hornet.MessageIDs, messagesPerMilestones []hornet.MessageIDs) hornet.MessageIDs,
	onNewMilestone func(msIndex milestone.Index, messages hornet.MessageIDs, conf *whiteflag.Confirmation, confStats *whiteflag.ConfirmedMilestoneStats)) (messages hornet.MessageIDs, messagesPerMilestones []hornet.MessageIDs)

BuildTangle builds a tangle structure without a tipselection algorithm, but random tips from the last messages in the last belowMaxDepth milestones.

func (*TestEnvironment) CleanupTestEnvironment

func (te *TestEnvironment) CleanupTestEnvironment(removeTempDir bool)

CleanupTestEnvironment cleans up everything at the end of the test.

func (*TestEnvironment) ConfigureUTXOCallbacks added in v1.1.0

func (te *TestEnvironment) ConfigureUTXOCallbacks(onMilestoneConfirmedFunc OnMilestoneConfirmedFunc, onLedgerUpdatedFunc OnLedgerUpdatedFunc)

func (*TestEnvironment) IssueAndConfirmMilestoneOnTips added in v1.0.0

func (te *TestEnvironment) IssueAndConfirmMilestoneOnTips(tips hornet.MessageIDs, createConfirmationGraph bool) (*whiteflag.Confirmation, *whiteflag.ConfirmedMilestoneStats)

IssueAndConfirmMilestoneOnTips creates a milestone on top of the given tips.

func (*TestEnvironment) NetworkID added in v1.1.0

func (te *TestEnvironment) NetworkID() iotago.NetworkID

func (*TestEnvironment) NewMessageBuilder added in v1.0.0

func (te *TestEnvironment) NewMessageBuilder(optionalIndexation ...string) *MessageBuilder

func (*TestEnvironment) NewTestMessage added in v1.0.0

func (te *TestEnvironment) NewTestMessage(index int, parents hornet.MessageIDs) *storage.MessageMetadata

func (*TestEnvironment) Storage added in v1.0.0

func (te *TestEnvironment) Storage() *storage.Storage

func (*TestEnvironment) StoreMessage added in v1.0.0

func (te *TestEnvironment) StoreMessage(msg *storage.Message) *storage.CachedMessage

StoreMessage adds the message to the storage layer and solidifies it. message +1

func (*TestEnvironment) SyncManager added in v1.1.0

func (te *TestEnvironment) SyncManager() *syncmanager.SyncManager

func (*TestEnvironment) UTXOManager added in v1.1.0

func (te *TestEnvironment) UTXOManager() *utxo.Manager

func (*TestEnvironment) VerifyCMI added in v1.0.0

func (te *TestEnvironment) VerifyCMI(index milestone.Index)

VerifyCMI checks if the confirmed milestone index is equal to the given milestone index.

func (*TestEnvironment) VerifyLMI

func (te *TestEnvironment) VerifyLMI(index milestone.Index)

VerifyLMI checks if the latest milestone index is equal to the given milestone index.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL