testsuite

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: Apache-2.0 Imports: 28 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) Store added in v1.0.0

func (m *Message) Store() *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) 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 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

	// GenesisOutput marks the initial output created when bootstrapping the tangle
	GenesisOutput *utxo.Output
	// 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) 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)

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

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) 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) NewMessageBuilder added in v1.0.0

func (te *TestEnvironment) NewMessageBuilder(indexation 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.

func (*TestEnvironment) UTXO added in v1.0.0

func (te *TestEnvironment) UTXO() *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