ganeti
Safe HaskellNone

Test.Ganeti.Locking.Waiting

Description

Tests for lock waiting structure.

Synopsis

Documentation

asWaitingTrans :: (Lock a, Ord b, Ord c) => LockWaiting a b c -> UpdateRequest a b c -> LockWaiting a b c Source #

Transform an UpdateRequest into the corresponding state transformer.

foldUpdates :: (Lock a, Ord b, Ord c) => [UpdateRequest a b c] -> LockWaiting a b c Source #

Fold a sequence of requests to transform a waiting strucutre onto the empty waiting. As we consider all exported transformations, any waiting structure can be obtained this way.

prop_NoActionWithPendingRequests :: Property Source #

Verify that an owner with a pending request cannot make any changes to the lock structure.

forAllBlocked :: Testable prop => (LockWaiting TestLock TestOwner Integer -> TestOwner -> Integer -> [LockRequest TestLock] -> prop) -> Property Source #

Quantifier for blocked requests. Quantifies over the generic situation that there is a state, an owner, and a request that is blocked for that owner. To obtain such a situation, we use the fact that there must be a different owner having at least one lock.

prop_WaitingRequestsGetPending :: Property Source #

Verify that an owner has a pending request after a waiting request not fullfilled immediately.

prop_PendingGetFulfilledEventually :: Property Source #

Verify that pending requests get fullfilled once all blockers release their resources.

prop_PendingGetNotifiedEventually :: Property Source #

Verify that the owner of a pending request gets notified once all blockers release their resources.

prop_Progress :: Property Source #

Verify that some progress is made after the direct blockers give up their locks. Note that we cannot guarantee that the original requester gets its request granted, as someone else might have a more important priority.

prop_ProgressSound :: Property Source #

Verify that the notifications send out are sound, i.e., upon notification the requests actually are fulfilled. To be sure to have at least one notification we, again, use the scenario that a request is blocked and then all the blockers release their resources.

prop_PendingJustified :: Property Source #

Verify that all pending requests are valid and cannot be fulfilled in the underlying lock allocation.

prop_UpdateIdempotent :: Property Source #

Verify that updateLocks is idempotent, except that in the repetition, no waiters are notified.

prop_extReprPreserved :: Property Source #

Verify that extRepr . fromExtRepr = id for all valid extensional representations.

prop_SimulateUpdateLocks :: Property Source #

Verify that any state is indistinguishable from its canonical version (i.e., the one obtained from the extensional representation) with respect to updateLocks.

prop_SimulateUpdateLocksWaiting :: Property Source #

Verify that any state is indistinguishable from its canonical version (i.e., the one obtained from the extensional representation) with respect to updateLocksWaiting.

prop_SafeUpdateWaitingCorrect :: Property Source #

Verify that if a requestor has no pending requests, safeUpdateWaiting conincides with updateLocksWaiting.

prop_SafeUpdateWaitingIdempotent :: Property Source #

Verify that safeUpdateLocksWaiting is idempotent, that in the repetition no notifications are done.

prop_ReadShow :: Property Source #

Verify that for LockWaiting we have readJSON . showJSON is extensionally equivalent to Ok.

prop_OpportunisticMonotone :: Property Source #

Verify that opportunistic union only increases the locks held.

prop_OpportunisticAnswer :: Property Source #

Verify the result list of the opportunistic union: if a lock is not in the result that, than its state has not changed, and if it is, it is as requested. The latter property is tested in that liberal way, so that we really can take arbitrary requests, including those that require both, shared and exlusive state for the same lock.

Orphan instances

(Arbitrary a, Lock a, Arbitrary b, Ord b, Arbitrary c, Ord c) => Arbitrary (LockWaiting a b c) # 
Instance details

Methods

arbitrary :: Gen (LockWaiting a b c)

shrink :: LockWaiting a b c -> [LockWaiting a b c]