FYI, I've added some minor tweaks in order to support QuickCheck 2.6:

diff --git a/test/hs/Test/Ganeti/JQueue/LockDecls.hs 
b/test/hs/Test/Ganeti/JQueue/LockDecls.hs
index fb3d8e5..ffcbb68 100644
--- a/test/hs/Test/Ganeti/JQueue/LockDecls.hs
+++ b/test/hs/Test/Ganeti/JQueue/LockDecls.hs
@@ -57,13 +57,13 @@ import Ganeti.JSON
 import Ganeti.OpCodes
 import Ganeti.Objects
 import Ganeti.Types
-
+import Test.Ganeti.TestCommon
 
 prop_staticWeight :: ConfigData -> Maybe OpCode -> [OpCode] -> Property
 prop_staticWeight cfg op ops =
   let weight = staticWeight cfg op ops
       maxWeight = C.staticLockSureBlockWeight * 5
-  in (weight >= 0 && weight <= (maxWeight+ C.staticLockBaseWeight)) === 
True
+  in (weight >= 0 && weight <= (maxWeight+ C.staticLockBaseWeight)) ==? 
True
 
 genExclusiveInstanceOp :: ConfigData -> Gen OpCode
 genExclusiveInstanceOp cfg = do
diff --git a/test/hs/Test/Ganeti/TestCommon.hs 
b/test/hs/Test/Ganeti/TestCommon.hs
index b844480..7b0d32d 100644
--- a/test/hs/Test/Ganeti/TestCommon.hs
+++ b/test/hs/Test/Ganeti/TestCommon.hs
@@ -54,6 +54,9 @@ module Test.Ganeti.TestCommon
   , runPython
   , checkPythonResult
   , DNSChar(..)
+#if !MIN_VERSION_QuickCheck(2,7,0)
+  , generate
+#endif
   , genPrintableAsciiChar
   , genPrintableAsciiString
   , genPrintableAsciiStringNE
@@ -113,7 +116,9 @@ import System.Process (readProcessWithExitCode)
 import qualified Test.HUnit as HUnit
 import Test.QuickCheck
 #if !MIN_VERSION_QuickCheck(2,7,0)
+import qualified System.Random as R
 import qualified Test.QuickCheck as QC
+import Test.QuickCheck.Gen ( Gen(..) )
 #endif
 import Test.QuickCheck.Monadic
 import qualified Text.JSON as J
@@ -598,4 +603,11 @@ listOfUniqueBy gen keyFun forbidden = do
 #if !MIN_VERSION_QuickCheck(2,7,0)
 counterexample :: Testable prop => String -> prop -> Property
 counterexample = QC.printTestCase
+
+-- | Run a generator. The size passed to the generator is always 30;
+-- Implementation adapted from Test.QuickCheck 2.7
+generate :: Gen a -> IO a
+generate (MkGen g) =
+  do r <- R.newStdGen
+     return (g r 30)
 #endif


On Tuesday, September 13, 2016 at 4:01:40 PM UTC+1, Viktor Bachraty wrote:
>
> Thank you both for cleaning up the patch and reviewing it! I'll submit 
> shortly.
>
> On Tue, Sep 13, 2016 at 3:58 PM, 'Klaus Aehlig' via ganeti-devel <
> [email protected]> wrote:
>
>> On Tue, Sep 13, 2016 at 03:28:06PM +0100, 'Federico Morg Pareschi' via 
>> ganeti-devel wrote:
>> > This is just a partial implementation of the static lock prediction 
>> system.
>> > With this, Ganeti queue system tries to predict the locks of the running
>> > jobs and schedule new jobs that are less likely to block.
>> > It is a partial implementation which might cause starvation for jobs 
>> stuck
>> > in the queue, following patches will address this issue.
>> >
>> > Signed-off-by: Federico Morg Pareschi <[email protected]>
>> > ---
>> >  src/Ganeti/Config.hs                    |   1 +
>> >  src/Ganeti/Constants.hs                 |  27 ++
>> >  src/Ganeti/JQScheduler.hs               |  26 +-
>> >  src/Ganeti/JQueue.hs                    |   1 +
>> >  src/Ganeti/JQueue/LockDecls.hs          | 591 ++++++++++++++++++++++++
>> >  src/Ganeti/Objects.hs                   |   1 -
>> >  test/hs/Test/Ganeti/JQueue/LockDecls.hs | 150 ++++++
>> >  test/hs/Test/Ganeti/Objects.hs          |  30 +-
>> >  test/hs/Test/Ganeti/OpCodes.hs          | 777 
>> ++++++++++++++++----------------
>> >  test/hs/Test/Ganeti/TestCommon.hs       |   2 +-
>> >  test/hs/htest.hs                        |   2 +
>> >  11 files changed, 1215 insertions(+), 393 deletions(-)
>> >  create mode 100644 src/Ganeti/JQueue/LockDecls.hs
>> >  create mode 100644 test/hs/Test/Ganeti/JQueue/LockDecls.hs
>>
>> LGTM, thanks.
>>
>> --
>> Klaus Aehlig
>> Google Germany GmbH, Erika-Mann-Str. 33, 80636 Muenchen
>> Registergericht und -nummer: Hamburg, HRB 86891
>> Sitz der Gesellschaft: Hamburg
>> Geschaeftsfuehrer: Matthew Scott Sucherman, Paul Terence Manicle
>>
>
>

Reply via email to