Safe Haskell | None |
---|---|
Language | Haskell2010 |
Test.Ouroboros.Network.LedgerPeers
Contents
Synopsis
- tests :: TestTree
- type ExtraTestInterface = ()
- cardanoSRVPrefix :: SRVPrefix
- data StakePool = StakePool {}
- newtype LedgerPools = LedgerPools {}
- calculateRelativeStake :: [StakePool] -> [(PoolStake, NonEmpty LedgerRelayAccessPoint)]
- genLedgerPoolsFrom :: [NonEmpty LedgerRelayAccessPoint] -> Gen LedgerPools
- prop_ledgerPeerSnapshot_requests :: StakeMapOverSource -> Property
- prop_pick100 :: Word16 -> NonNegative Int -> LedgerPeersKind -> MockRoots -> DelayAndTimeoutScripts -> SlotNo -> Property
- prop_pick :: LedgerPools -> LedgerPeersKind -> Word16 -> Word16 -> MockRoots -> Script DNSLookupDelay -> SlotNo -> Property
- prop_accumulateBigLedgerStake :: LedgerPools -> Property
- prop_recomputeRelativeStake :: LedgerPools -> Property
- prop_getLedgerPeers :: SlotNo -> LedgerPools -> SlotNo -> Property
- prop_ledgerPeerSnapshotCBORV2 :: LedgerPeerSnapshotSRVSupport -> SlotNo -> LedgerPools -> Property
- prop_ledgerPeerSnapshotJSONV2 :: SlotNo -> LedgerPools -> Property
- snapshotV2 :: SlotNo -> LedgerPools -> LedgerPeerSnapshot
- data SimResult a
- = SimReturn a [String]
- | SimException SomeException [String]
- | SimDeadLock [String]
- evaluateTrace :: SimTrace a -> IO (SimResult a)
- data WithThreadAndTime a = WithThreadAndTime {
- wtatOccuredAt :: !Time
- wtatWithinThread :: !String
- wtatEvent :: !a
- verboseTracer :: forall a (m :: Type -> Type). (MonadSay m, Show a) => Tracer m a
- threadAndTimeTracer :: forall a (m :: Type -> Type). (MonadAsync m, MonadMonotonicTime m) => Tracer m (WithThreadAndTime a) -> Tracer m a
Documentation
type ExtraTestInterface = () Source #
newtype LedgerPools Source #
Constructors
LedgerPools | |
Fields |
Instances
Arbitrary LedgerPools Source # | Calculate relative stake. PRECONDITION: total stake must be > 0, otherwise the exception `Ratio has zero denominator` is thrown (see https://github.com/IntersectMBO/ouroboros-network/issues/5091). |
Defined in Test.Ouroboros.Network.LedgerPeers | |
Show LedgerPools Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers Methods showsPrec :: Int -> LedgerPools -> ShowS # show :: LedgerPools -> String # showList :: [LedgerPools] -> ShowS # |
Arguments
:: [NonEmpty LedgerRelayAccessPoint] | each inner list denotes relays of one pool. PRECONDITION: each inner list must be non-empty. |
-> Gen LedgerPools |
Enhance a list of pools, each one represented by a list of
RelayAccessPoint
, with a stake.
prop_ledgerPeerSnapshot_requests :: StakeMapOverSource -> Property Source #
This test checks whether requesting ledger peers works as intended when snapshot data is available. For each request, peers must be returned from the right source - either the ledger or snapshot, depending on whether which source is fresher.
Arguments
:: Word16 | |
-> NonNegative Int | number of pools with 0 stake |
-> LedgerPeersKind | |
-> MockRoots | |
-> DelayAndTimeoutScripts | |
-> SlotNo | |
-> Property |
A pool with 100% stake should always be picked.
prop_pick :: LedgerPools -> LedgerPeersKind -> Word16 -> Word16 -> MockRoots -> Script DNSLookupDelay -> SlotNo -> Property Source #
Verify that given at least one peer we manage to pick count
peers.
prop_recomputeRelativeStake :: LedgerPools -> Property Source #
This functions checks the following properties: 1. The accumulated relative stake adds up to unity 2. No pool relative stake can be less than 0 3. The relays aren't mangled 4. Running this function multiple times always produces the same result
prop_getLedgerPeers :: SlotNo -> LedgerPools -> SlotNo -> Property Source #
prop_ledgerPeerSnapshotCBORV2 :: LedgerPeerSnapshotSRVSupport -> SlotNo -> LedgerPools -> Property Source #
Checks validity of LedgerPeerSnapshot CBOR encoding, and whether round trip cycle is the identity function
TODO: move to `ouroboros-network-api:test`
prop_ledgerPeerSnapshotJSONV2 :: SlotNo -> LedgerPools -> Property Source #
Tests if LedgerPeerSnapshot JSON round trip is the identity function
TODO: move to `ouroboros-network-api:test`
snapshotV2 :: SlotNo -> LedgerPools -> LedgerPeerSnapshot Source #
helper functions for ledgerpeersnapshot encoding tests
Constructors
SimReturn a [String] | |
SimException SomeException [String] | |
SimDeadLock [String] |
data WithThreadAndTime a Source #
Constructors
WithThreadAndTime | |
Fields
|
Instances
Show a => Show (WithThreadAndTime a) Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers Methods showsPrec :: Int -> WithThreadAndTime a -> ShowS # show :: WithThreadAndTime a -> String # showList :: [WithThreadAndTime a] -> ShowS # |
threadAndTimeTracer :: forall a (m :: Type -> Type). (MonadAsync m, MonadMonotonicTime m) => Tracer m (WithThreadAndTime a) -> Tracer m a Source #