ganeti
Safe HaskellNone

Test.Ganeti.Locking.Allocation

Description

Tests for lock allocation.

Synopsis

Documentation

data TestOwner Source #

Constructors

TestOwner Int 

Instances

Instances details
Eq TestOwner # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

(==) :: TestOwner -> TestOwner -> Bool

(/=) :: TestOwner -> TestOwner -> Bool

Ord TestOwner # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

compare :: TestOwner -> TestOwner -> Ordering

(<) :: TestOwner -> TestOwner -> Bool

(<=) :: TestOwner -> TestOwner -> Bool

(>) :: TestOwner -> TestOwner -> Bool

(>=) :: TestOwner -> TestOwner -> Bool

max :: TestOwner -> TestOwner -> TestOwner

min :: TestOwner -> TestOwner -> TestOwner

Show TestOwner # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

showsPrec :: Int -> TestOwner -> ShowS

show :: TestOwner -> String

showList :: [TestOwner] -> ShowS

JSON TestOwner # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

readJSON :: JSValue -> Result TestOwner

showJSON :: TestOwner -> JSValue

readJSONs :: JSValue -> Result [TestOwner]

showJSONs :: [TestOwner] -> JSValue

Arbitrary TestOwner # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

data TestLock Source #

Instances

Instances details
Eq TestLock # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

(==) :: TestLock -> TestLock -> Bool

(/=) :: TestLock -> TestLock -> Bool

Ord TestLock # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

compare :: TestLock -> TestLock -> Ordering

(<) :: TestLock -> TestLock -> Bool

(<=) :: TestLock -> TestLock -> Bool

(>) :: TestLock -> TestLock -> Bool

(>=) :: TestLock -> TestLock -> Bool

max :: TestLock -> TestLock -> TestLock

min :: TestLock -> TestLock -> TestLock

Read TestLock # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

readsPrec :: Int -> ReadS TestLock

readList :: ReadS [TestLock]

readPrec :: ReadPrec TestLock

readListPrec :: ReadPrec [TestLock]

Show TestLock # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

showsPrec :: Int -> TestLock -> ShowS

show :: TestLock -> String

showList :: [TestLock] -> ShowS

JSON TestLock # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Methods

readJSON :: JSValue -> Result TestLock

showJSON :: TestLock -> JSValue

readJSONs :: JSValue -> Result [TestLock]

showJSONs :: [TestLock] -> JSValue

Lock TestLock # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

Arbitrary TestLock # 
Instance details

Defined in Test.Ganeti.Locking.Allocation

asAllocTrans :: (Lock a, Ord b, Show b) => LockAllocation a b -> UpdateRequest b a -> LockAllocation a b Source #

Transform an UpdateRequest into the corresponding state transformer.

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

Fold a sequence of requests to transform a lock allocation onto the empty allocation. As we consider all exported LockAllocation transformers, any LockAllocation definable is obtained in this way.

prop_LocksDisjoint :: Property Source #

Basic property of locking: the exclusive locks of one user are disjoint from any locks of any other user.

prop_LockslistComplete :: Property Source #

Verify that the list of active locks indeed contains all locks that are owned by someone.

prop_LocksAllOwnersSubsetLockslist :: Property Source #

Verify that the list of all locks with states is contained in the list of all locks.

prop_LocksAllOwnersComplete :: Property Source #

Verify that all locks of all owners are mentioned in the list of all locks' owner's state.

prop_LocksAllOwnersSound :: Property Source #

Verify that all lock owners mentioned in the list of all locks' owner's state actually own their lock.

prop_LockImplicationX :: Property Source #

Verify that exclusive group locks are honored, i.e., verify that if someone holds a lock, then no one else can hold a lock on an exclusive lock on an implied lock.

prop_LockImplicationS :: Property Source #

Verify that shared group locks are honored, i.e., verify that if someone holds an exclusive lock, then no one else can hold any form on lock on an implied lock.

prop_LocksStable :: Property Source #

Verify that locks can only be modified by updates of the owner.

requestSucceeded :: Ord a => Map a OwnerState -> LockRequest a -> Bool Source #

Verify that a given request is statisfied in list of owned locks

prop_LockupdateAtomic :: Property Source #

Verify that lock updates are atomic, i.e., either we get all the required locks, or the state is completely unchanged.

prop_LockReleaseSucceeds :: Property Source #

Verify that releasing a lock always succeeds.

prop_BlockSufficient :: Property Source #

Verify the property that only the blocking owners prevent lock allocation. We deliberatly go for the expensive variant restraining by suchThat, as otherwise the number of cases actually covered is too small.

prop_BlockNecessary :: Property Source #

Verify the property that every blocking owner is necessary, i.e., even if we only keep the locks of one of the blocking owners, the request still will be blocked. We deliberatly use the expensive variant of restraining to ensure good coverage. To make sure the request can always be blocked by two owners, for a shared request we request two different locks.

prop_ReadShow :: Property Source #

Verify that for LockAllocation we have readJSON . showJSON = Ok.

prop_OwnerComplete :: Property Source #

Verify that the list of lock owners is complete.

prop_OwnerSound :: Property Source #

Verify that each owner actually owns a lock.

prop_ReadShowRequest :: Property Source #

Verify that for LockRequest we have readJSON . showJSON = Ok.

Orphan instances

Arbitrary OwnerState # 
Instance details

Arbitrary a => Arbitrary (LockRequest a) # 
Instance details

Methods

arbitrary :: Gen (LockRequest a)

shrink :: LockRequest a -> [LockRequest a]

(Arbitrary a, Lock a, Arbitrary b, Ord b, Show b) => Arbitrary (LockAllocation a b) # 
Instance details

Methods

arbitrary :: Gen (LockAllocation a b)

shrink :: LockAllocation a b -> [LockAllocation a b]