LGTM

On Tue, Mar 4, 2014 at 11:01 AM, Klaus Aehlig <[email protected]> wrote:

> As specified in our design, if A is a group lock and B
> belongs to A, then A must be earlier in the lock order
> than B. Verify this property.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  test/hs/Test/Ganeti/Locking/Locks.hs | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/test/hs/Test/Ganeti/Locking/Locks.hs
> b/test/hs/Test/Ganeti/Locking/Locks.hs
> index 3354981..4c0c9a6 100644
> --- a/test/hs/Test/Ganeti/Locking/Locks.hs
> +++ b/test/hs/Test/Ganeti/Locking/Locks.hs
> @@ -37,6 +37,7 @@ import Test.Ganeti.TestHelper
>  import Test.Ganeti.TestCommon
>
>  import Ganeti.Locking.Locks
> +import Ganeti.Locking.Types
>
>  instance Arbitrary GanetiLocks where
>    arbitrary = oneof [ return BGL
> @@ -58,7 +59,16 @@ prop_ReadShow :: Property
>  prop_ReadShow = forAll (arbitrary :: Gen GanetiLocks) $ \a ->
>    readJSON (showJSON a) ==? Ok a
>
> +-- | Verify the implied locks are earlier in the lock order.
> +prop_ImpliedOrder :: Property
> +prop_ImpliedOrder =
> +  forAll ((arbitrary :: Gen GanetiLocks)
> +          `suchThat` (not . null . lockImplications)) $ \b ->
> +  printTestCase "Implied locks must be earlier in the lock order"
> +  . flip all (lockImplications b) $ \a ->
> +  a < b
>
>  testSuite "Locking/Locks"
>   [ 'prop_ReadShow
> + , 'prop_ImpliedOrder
>   ]
> --
> 1.9.0.279.gdc9e3eb
>
>

Reply via email to