ganeti
Safe HaskellNone

Test.Ganeti.SlotMap

Description

Unittests for the SlotMap.

Synopsis

Documentation

genSlotLimit :: Gen Int Source #

Generates a number typical for the limit of a Slot. Useful for constructing resource bounds when not directly constructing the relevant Slots.

genSlotCount :: Gen Int Source #

Generates a number typical for the occupied count of a Slot. Useful for constructing CountMaps.

resampleFittingSlot :: Slot -> Gen Slot Source #

Takes a slot and resamples its slotOccupied count to fit the limit.

type TestKey = String Source #

What we use as key for testing SlotMaps.

genTestKey :: Gen TestKey Source #

Generates short strings used as SlotMap keys.

We limit ourselves to a small set of key strings with high probability to increase the chance that SlotMaps actually have more than one slot taken.

listSizeGen :: Gen Int Source #

Generates small lists.

genSlotMap :: Ord a => Gen a -> Gen (SlotMap a) Source #

Generates a SlotMap given a generator for the keys (see genTestKey).

genCountMap :: Ord a => Gen a -> Gen (CountMap a) Source #

Generates a CountMap given a generator for the keys (see genTestKey).

overfullKeys :: Ord a => SlotMap a -> Set a Source #

Tells which keys of a SlotMap are overfull.

genFittingSlotMap :: Ord a => Gen a -> Gen (SlotMap a) Source #

Generates a SlotMap for which all slots are within their limits.

Test cases

case_isOverfull :: Assertion Source #

keyUnion :: Ord a => Map a b -> Map a c -> Set a Source #

Union of the keys of two maps.

prop_occupySlots :: Property Source #

Tests properties of SlotMaps being filled up.

case_hasSlotsFor_examples :: Assertion Source #

Tests for whether there's still space for a job given its rate limits.

prop_hasSlotsFor_fitting :: Property Source #

Tests properties of hasSlotsFor on SlotMaps that are known to respect their limits.

prop_hasSlotsFor :: Property Source #

Tests properties of hasSlotsFor, irrespective of whether the input SlotMaps respect their limits or not.

Orphan instances

Arbitrary Slot # 
Instance details

Methods

arbitrary :: Gen Slot

shrink :: Slot -> [Slot]