Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- tests ∷ TestTree
- data Event
- data WithNumberOfConnections a = WithNumberOfConnections {}
- newtype Arb a = Arb {
- getArb ∷ a
- genEvent ∷ Gen Event
- toDiffTime ∷ NonNegative Int → DiffTime
- fixEvents ∷ [Event] → [Event]
- genAcceptedConnectionsLimit ∷ Int → Gen AcceptedConnectionsLimit
- shrinkAcceptedConnectionsLimit ∷ AcceptedConnectionsLimit → [AcceptedConnectionsLimit]
- rateLimittingExperiment ∷ ∀ m. (MonadAsync m, MonadDelay m) ⇒ Tracer m (WithNumberOfConnections AcceptConnectionsPolicyTrace) → AcceptedConnectionsLimit → [Event] → m ()
- runRateLimitExperiment ∷ AcceptedConnectionsLimit → [Event] → [WithNumberOfConnections AcceptConnectionsPolicyTrace]
- propRateLimit_NotExceedHardLimit ∷ Arb ([Event], AcceptedConnectionsLimit) → Property
- propRateLimit_SoftLimitDelay ∷ Arb ([Event], AcceptedConnectionsLimit) → Property
- interpr ∷ Int → Event → Int → Int
- numberOfTurnsAboveHardLimit ∷ AcceptedConnectionsLimit → [Event] → Int
- numberOfTurnsAboveSoftLimit ∷ AcceptedConnectionsLimit → [Event] → Int
- buckets ∷ Int → String
Documentation
To emulate environment we generate Event
s: we either receive a new
connection, or one of the accepted connections is terminating.
DiffTime
- a delay between consecutive events.
data WithNumberOfConnections a Source #
A newtype wrapper for Arbitrary
instances.
rateLimittingExperiment ∷ ∀ m. (MonadAsync m, MonadDelay m) ⇒ Tracer m (WithNumberOfConnections AcceptConnectionsPolicyTrace) → AcceptedConnectionsLimit → [Event] → m () Source #
runRateLimitExperiment ∷ AcceptedConnectionsLimit → [Event] → [WithNumberOfConnections AcceptConnectionsPolicyTrace] Source #
Run rateLimittingExperiment
in IOSim
, and return the trace.
propRateLimit_NotExceedHardLimit ∷ Arb ([Event], AcceptedConnectionsLimit) → Property Source #
We never should exceed the hard limit.
propRateLimit_SoftLimitDelay ∷ Arb ([Event], AcceptedConnectionsLimit) → Property Source #
When above soft limit and below the hard limit, the delay should be
between '0' and acceptedConnectionsDelay
.