ouroboros-network-0.10.1.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Ouroboros.Network.PeerSelection.PeerMetric

Synopsis

Documentation

tests :: TestTree Source #

newtype TestAddress Source #

Constructors

TestAddress Int 

Instances

Instances details
Arbitrary TestAddress Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Show TestAddress Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

NFData TestAddress Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Methods

rnf :: TestAddress -> () Source #

Eq TestAddress Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Ord TestAddress Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

NoThunks TestAddress Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Methods

noThunks :: Context -> TestAddress -> IO (Maybe ThunkInfo)

wNoThunks :: Context -> TestAddress -> IO (Maybe ThunkInfo)

showTypeOf :: Proxy TestAddress -> String

data Event Source #

Constructors

FetchedHeader TestAddress SlotNo 
FetchedBlock TestAddress SlotNo SizeInBytes 

Instances

Instances details
Arbitrary Event Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

Methods

arbitrary :: Gen Event

shrink :: Event -> [Event]

Show Event Source # 
Instance details

Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric

eventSlot :: Event -> SlotNo Source #

mkFixedScript :: Script Event -> FixedScript Source #

Order events by SlotNo

TODO: SizeInBytes should be a function of SlotNo

simulatePeerMetricScript :: forall m. (MonadDelay m, MonadTimer m, MonadMonotonicTime m, MonadLabelledSTM m, MonadTraceSTM m) => Tracer m PeerMetricsTrace -> PeerMetricsConfiguration -> FixedScript -> m () Source #

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.

prop_simScript :: FixedScript -> Property Source #

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

simulatePeerMetricScriptWithoutDelays :: forall m. 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.