| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Consensus.Leios.NodeUnderTest
Description
One real node, the node under test (NUT), and a mocked environment around
it. The nut prefix of names here abbreviates it.
The node is built by the node's own initNodeKernel over a ChainDB on a
mocked filesystem, so the code under test is the node's, not a
reimplementation of it. Its block is LeiosTestBlock. It does not forge,
since the test gives it no block forging.
The node's node-to-node applications and the versions it offers them at are
built by the node's own mkNodeToNodeApps and
mkNodeToNodeInitiatorResponderVersions, as a running node builds them.
Everything outside the node is the test's: the environment runs the other end of each of the node's connections itself.
Synopsis
- type Blk = LeiosTestBlock
- data NodeUnderTest (m ∷ Type → Type) = NodeUnderTest {
- nutChainDB ∷ ChainDB m Blk
- nutTopLevelConfig ∷ TopLevelConfig Blk
- nutKernel ∷ NodeKernel m PeerAddr (ConnectionId ()) Blk
- nutApps ∷ BlockNodeToNodeVersion Blk → NodeApps m
- nutVersions ∷ NodeVersions m
- nutSeeds ∷ Seeds StdGen
- data NodeUnderTestConfig = NodeUnderTestConfig {}
- type NodeVersions (m ∷ Type → Type) = Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosBundleWithExpandedCtx 'InitiatorResponderMode PeerAddr PeerTrustable ByteString m NodeToNodeInitiatorResult ())
- newtype PeerAddr = PeerAddr Int
- data Seeds a = Seeds {}
- decodePeerAddr ∷ Decoder s PeerAddr
- encodePeerAddr ∷ PeerAddr → Encoding
- nodeVersionData ∷ NodeToNodeVersion → NodeToNodeVersionData
- defaultNodeUnderTestConfig ∷ SecurityParam → LeiosTestLedgerConfig → NodeUnderTestConfig
- withNodeUnderTest ∷ NodeUnderTestConfig → NodeDBs (StrictTMVar (IOSim s) MockFS) → (NodeUnderTest (IOSim s) → IOSim s a) → IOSim s a
Documentation
type Blk = LeiosTestBlock Source #
data NodeUnderTest (m ∷ Type → Type) Source #
A running node, and the handles a test needs on it for its gray-box predicates.
Constructors
| NodeUnderTest | |
Fields
| |
data NodeUnderTestConfig Source #
What a test can vary about the node.
Constructors
| NodeUnderTestConfig | |
Fields
| |
type NodeVersions (m ∷ Type → Type) = Versions NodeToNodeVersion NodeToNodeVersionData (OuroborosBundleWithExpandedCtx 'InitiatorResponderMode PeerAddr PeerTrustable ByteString m NodeToNodeInitiatorResult ()) Source #
The node's node-to-node applications for each version it supports, as it offers them on a connection where it is both initiator and responder.
The peer address these tests use: a peer is just a number.
All the randomness of a Leios node-vs-environment test.
Constructors
| Seeds | |
Fields
| |
Instances
| Functor Seeds Source # | |
| Foldable Seeds Source # | |
Defined in Test.Consensus.Leios.NodeUnderTest Methods fold ∷ Monoid m ⇒ Seeds m → m # foldMap ∷ Monoid m ⇒ (a → m) → Seeds a → m # foldMap' ∷ Monoid m ⇒ (a → m) → Seeds a → m # foldr ∷ (a → b → b) → b → Seeds a → b # foldr' ∷ (a → b → b) → b → Seeds a → b # foldl ∷ (b → a → b) → b → Seeds a → b # foldl' ∷ (b → a → b) → b → Seeds a → b # foldr1 ∷ (a → a → a) → Seeds a → a # foldl1 ∷ (a → a → a) → Seeds a → a # elem ∷ Eq a ⇒ a → Seeds a → Bool # maximum ∷ Ord a ⇒ Seeds a → a # | |
| Traversable Seeds Source # | |
nodeVersionData ∷ NodeToNodeVersion → NodeToNodeVersionData Source #
The version data a relay offers: it accepts inbound connections and shares peers.
withNodeUnderTest ∷ NodeUnderTestConfig → NodeDBs (StrictTMVar (IOSim s) MockFS) → (NodeUnderTest (IOSim s) → IOSim s a) → IOSim s a Source #
Run the node over the given mocked filesystems, then shut it down.
As in a node's database directory, the immutable file system holds the ImmutableDB, and the volatile one holds every other database, each in its own subdirectory. The ledger and GSM file systems go unused.