ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

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

Documentation

data NodeUnderTest (m ∷ Type → Type) Source #

A running node, and the handles a test needs on it for its gray-box predicates.

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.

newtype PeerAddr Source #

The peer address these tests use: a peer is just a number.

Constructors

PeerAddr Int 

Instances

Instances details
NFData PeerAddr Source # 
Instance details

Defined in Test.Consensus.Leios.NodeUnderTest

Methods

rnf ∷ PeerAddr → () #

Eq PeerAddr Source # 
Instance details

Defined in Test.Consensus.Leios.NodeUnderTest

Methods

(==) ∷ PeerAddr → PeerAddr → Bool #

(/=) ∷ PeerAddr → PeerAddr → Bool #

Ord PeerAddr Source # 
Instance details

Defined in Test.Consensus.Leios.NodeUnderTest

Show PeerAddr Source # 
Instance details

Defined in Test.Consensus.Leios.NodeUnderTest

Methods

showsPrec ∷ Int → PeerAddr → ShowS #

show ∷ PeerAddr → String #

showList ∷ [PeerAddr] → ShowS #

Hashable PeerAddr Source # 
Instance details

Defined in Test.Consensus.Leios.NodeUnderTest

NoThunks PeerAddr Source # 
Instance details

Defined in Test.Consensus.Leios.NodeUnderTest

data Seeds a Source #

All the randomness of a Leios node-vs-environment test.

Constructors

Seeds 

Fields

Instances

Instances details
Functor Seeds Source # 
Instance details

Defined in Test.Consensus.Leios.NodeUnderTest

Methods

fmap ∷ (a → b) → Seeds a → Seeds b #

(<$) ∷ a → Seeds b → Seeds a #

Foldable Seeds Source # 
Instance details

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 #

toList ∷ Seeds a → [a] #

null ∷ Seeds a → Bool #

length ∷ Seeds a → Int #

elem ∷ Eq a ⇒ a → Seeds a → Bool #

maximum ∷ Ord a ⇒ Seeds a → a #

minimum ∷ Ord a ⇒ Seeds a → a #

sum ∷ Num a ⇒ Seeds a → a #

product ∷ Num a ⇒ Seeds a → a #

Traversable Seeds Source # 
Instance details

Defined in Test.Consensus.Leios.NodeUnderTest

Methods

traverse ∷ Applicative f ⇒ (a → f b) → Seeds a → f (Seeds b) #

sequenceA ∷ Applicative f ⇒ Seeds (f a) → f (Seeds a) #

mapM ∷ Monad m ⇒ (a → m b) → Seeds a → m (Seeds b) #

sequence ∷ Monad m ⇒ Seeds (m a) → m (Seeds a) #

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.