ouroboros-network:ouroboros-network-tests-lib
Safe HaskellNone
LanguageHaskell2010

Test.Ouroboros.Network.PeerSelection.PeerMetric

Synopsis

Documentation

newtype TestAddress Source #

Constructors

TestAddress Int 

data Event Source #

Instances

Instances details
Arbitrary Event Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Methods

arbitrary :: Gen Event #

shrink :: Event -> [Event] #

NFData Event Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Methods

rnf :: Event -> () #

Generic Event Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Methods

from :: Event -> Rep Event x #

to :: Rep Event x -> Event #

Show Event Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

type Rep Event Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

mkFixedScript :: Script Event -> FixedScript Source #

Order events by SlotNo

TODO: SizeInBytes should be a function of SlotNo

prop_insert_peer :: FixedScript -> Property Source #

Check that newly added peer is never in the 20% worst performing peers (if there are at least 5 results).

prop_metrics_are_bounded :: FixedScript -> Property Source #

Check that the results are always positive.

prop_bounded_size :: Positive Int -> FixedScript -> Property Source #

Check that the result are bounded.

The bound is maxEntriesToTrack times number of peers in the simulation. This could be lowered by computing number of peers in each maxEntriesToTrack slots window.

microbenchmark1GenerateInput :: Bool -> Int -> IO FixedScript Source #

microbenchmark1 n - one test of simple property on a FixedScript of length n: one input, one property, one test.

We split into generating input and running/checking it so we can more accurately measure the latter.

we shouldn't use QuickCheck

and we shouldn't use IOSim (which prop_simScript) is using.

prop_simScript :: FixedScript -> Property Source #

one simple property (pmtUpstreamyness >= 0) checked on the trace of a script:

simulatePeerMetricScriptWithoutDelays :: MonadLabelledSTM m => Tracer m PeerMetricsTrace -> PeerMetricsConfiguration -> FixedScript -> m () Source #

similar to simulatePeerMetricScript: but we don't do in "real/simulated" time: not calling getMonotonicTime and threadDelay.