Safe Haskell | None |
---|---|
Language | Haskell2010 |
Test.Ouroboros.Network.LedgerPeers
Synopsis
- tests :: TestTree
- type ExtraTestInterface = ()
- newtype ArbitraryPortNumber = ArbitraryPortNumber {}
- newtype ArbitraryRelayAccessPoint = ArbitraryRelayAccessPoint {}
- newtype ArbitrarySlotNo = ArbitrarySlotNo {}
- data StakePool = StakePool {}
- newtype LedgerPools = LedgerPools {}
- calculateRelativeStake :: [StakePool] -> [(PoolStake, NonEmpty RelayAccessPoint)]
- genLedgerPoolsFrom :: [RelayAccessPoint] -> Gen LedgerPools
- newtype ArbLedgerPeersKind = ArbLedgerPeersKind LedgerPeersKind
- newtype ArbStakeMapOverSource = ArbStakeMapOverSource {}
- prop_ledgerPeerSnapshot_requests :: ArbStakeMapOverSource -> Property
- prop_pick100 :: Word16 -> NonNegative Int -> ArbLedgerPeersKind -> MockRoots -> DelayAndTimeoutScripts -> ArbitrarySlotNo -> Property
- prop_pick :: LedgerPools -> ArbLedgerPeersKind -> Word16 -> Word16 -> MockRoots -> Script DNSLookupDelay -> ArbitrarySlotNo -> Property
- prop_accumulateBigLedgerStake :: LedgerPools -> Property
- prop_recomputeRelativeStake :: LedgerPools -> Property
- prop_getLedgerPeers :: ArbitrarySlotNo -> LedgerPools -> ArbitrarySlotNo -> Property
- prop_ledgerPeerSnapshotCBORV1 :: ArbitrarySlotNo -> LedgerPools -> Property
- prop_ledgerPeerSnapshotJSONV1 :: ArbitrarySlotNo -> LedgerPools -> Property
- snapshotV1 :: ArbitrarySlotNo -> 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 ArbitraryPortNumber Source #
Constructors
ArbitraryPortNumber | |
Fields |
Instances
Arbitrary ArbitraryPortNumber Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers Methods |
newtype ArbitraryRelayAccessPoint Source #
Constructors
ArbitraryRelayAccessPoint | |
Instances
newtype ArbitrarySlotNo Source #
Constructors
ArbitrarySlotNo | |
Fields |
Instances
Arbitrary ArbitrarySlotNo Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers | |
Show ArbitrarySlotNo Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers Methods showsPrec :: Int -> ArbitrarySlotNo -> ShowS # show :: ArbitrarySlotNo -> String # showList :: [ArbitrarySlotNo] -> ShowS # |
newtype LedgerPools Source #
Constructors
LedgerPools | |
Fields |
Instances
Arbitrary LedgerPools Source # | |
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 # |
calculateRelativeStake :: [StakePool] -> [(PoolStake, NonEmpty RelayAccessPoint)] Source #
newtype ArbLedgerPeersKind Source #
Constructors
ArbLedgerPeersKind LedgerPeersKind |
Instances
Arbitrary ArbLedgerPeersKind Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers | |
Show ArbLedgerPeersKind Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers Methods showsPrec :: Int -> ArbLedgerPeersKind -> ShowS # show :: ArbLedgerPeersKind -> String # showList :: [ArbLedgerPeersKind] -> ShowS # |
newtype ArbStakeMapOverSource Source #
Constructors
ArbStakeMapOverSource | |
Instances
Arbitrary ArbStakeMapOverSource Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers Methods arbitrary :: Gen ArbStakeMapOverSource # shrink :: ArbStakeMapOverSource -> [ArbStakeMapOverSource] # | |
Show ArbStakeMapOverSource Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers Methods showsPrec :: Int -> ArbStakeMapOverSource -> ShowS # show :: ArbStakeMapOverSource -> String # showList :: [ArbStakeMapOverSource] -> ShowS # |
prop_ledgerPeerSnapshot_requests :: ArbStakeMapOverSource -> 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 |
-> ArbLedgerPeersKind | |
-> MockRoots | |
-> DelayAndTimeoutScripts | |
-> ArbitrarySlotNo | |
-> Property |
A pool with 100% stake should always be picked.
prop_pick :: LedgerPools -> ArbLedgerPeersKind -> Word16 -> Word16 -> MockRoots -> Script DNSLookupDelay -> ArbitrarySlotNo -> 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_ledgerPeerSnapshotCBORV1 :: ArbitrarySlotNo -> LedgerPools -> Property Source #
Checks validity of LedgerPeerSnapshot CBOR encoding, and whether round trip cycle is the identity function
prop_ledgerPeerSnapshotJSONV1 :: ArbitrarySlotNo -> LedgerPools -> Property Source #
Tests if LedgerPeerSnapshot JSON round trip is the identity function
snapshotV1 :: ArbitrarySlotNo -> 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 #