Module agora.utils.Test

Various utilities for testing purpose

Utilities in this module can be used in test code. There are currently multiple testing approaches: - Unittests in the various agora module, the most common, cheapest, and a way to do white box testing; - Unittests under agora.test: Those unittests rely on the LocalRest library to simulate a network where nodes are thread who communicate via message passing. - Unit integration tests in ${ROOT}/tests/unit/ which are similar to unittests but provide a way to test IO-using code. - System integration tests: those are fully fledged tests that spawns unmodified, real nodes within Docker containers and act as a client.

Any symbol in this module can be used by any of those method, which is why this module is neither restricted by package(agora): nor version(unittest):.

Functions

NameDescription
ensureSingleCall() A little utility to ensure a function is only called once
genesisSpendable() Convenience function for Genesis Block unittest
makeCleanTempDir(postfix) Get a temporary directory for unit integration tests
preImageJitter(h1, h2, max_jitter) Given two hash, where one is potentially the pre-image of the other, find by how much they actually differ.
simulatePreimages(ledger, height, skip_indexes) Externalize pre-images for all validators (minus skipped ones) at height
spendable(block) Takes a block object and filters the payment outputs into a range of TxBuilder objects.

Structs

NameDescription
WK A list of well-known (WK) values which can be used in tests

Aliases

NameTypeDescription
TxBuilder StaticTransactionBuilder!(agora.utils.Test.WKUnlocker(inrefagora.consensus.data.Transaction.Transaction,inrefagora.utils.TxBuilder.OutputRef))