Commit dc4b5c42 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add explicit test for wrong OpCode arbitrary instances

I've been bitten a couple of times with arbitrary opcodes working on
UTF-8 locale, but failing on buildbot (ASCII). So let's add an
explicit test that checks always (even with UTF-8) for correct
arbitrary values, showing explicitly which opcodes fail.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarHelga Velroyen <>
parent 139c0683
......@@ -35,6 +35,8 @@ import qualified Test.HUnit as HUnit
import Test.QuickCheck
import Control.Applicative
import Control.Monad
import Data.Char
import Data.List
import qualified Data.Map as Map
import qualified Text.JSON as J
......@@ -441,6 +443,11 @@ case_py_compat = do
(arbitrary::Gen OpCodes.OpCode))
let opcodes = head sample_opcodes
serialized = J.encode opcodes
-- check for non-ASCII fields, usually due to 'arbitrary :: String'
mapM_ (\op -> when (any (not . isAscii) (J.encode op)) .
HUnit.assertFailure $
"OpCode has non-ASCII fields: " ++ show op
) opcodes
py_stdout <-
runPython "from ganeti import opcodes\n\
\import sys\n\
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment