-}
-module Test.Ganeti.Confd.Utils (testConfdUtils) where
+module Test.Ganeti.Confd.Utils (testConfd_Utils) where
import Control.Applicative
import Test.QuickCheck
BasicTypes.Bad "HMAC verification failed" ==?
Confd.Utils.parseRequest key_verify encoded
-testSuite "ConfdUtils"
+testSuite "Confd/Utils"
[ 'prop_req_sign
, 'prop_bad_key
]
-}
-module Test.Ganeti.HTools.CLI (testCLI) where
+module Test.Ganeti.HTools.CLI (testHTools_CLI) where
import Test.QuickCheck
-- apply checkEarlyExit across the cartesian product of params and opts
in conjoin [checkEarlyExit n o p | p <- params, (n, o) <- opts]
-testSuite "CLI"
+testSuite "HTools/CLI"
[ 'prop_parseISpec
, 'prop_parseISpecFail
, 'prop_parseYesNo
-}
-module Test.Ganeti.HTools.Cluster (testCluster) where
+module Test.Ganeti.HTools.Cluster (testHTools_Cluster) where
import Test.QuickCheck
nl = makeSmallCluster node' count
in not $ canAllocOn nl rqn inst
-testSuite "Cluster"
+testSuite "HTools/Cluster"
[ 'prop_Score_Zero
, 'prop_CStats_sane
, 'prop_Alloc_sane
-}
-module Test.Ganeti.HTools.Container (testContainer) where
+module Test.Ganeti.HTools.Container (testHTools_Container) where
import Test.QuickCheck
printTestCase "Found non-existing name"
(isNothing (Container.findByName nl' othername))
-testSuite "Container"
+testSuite "HTools/Container"
[ 'prop_addTwo
, 'prop_nameOf
, 'prop_findByName
-}
module Test.Ganeti.HTools.Instance
- ( testInstance
+ ( testHTools_Instance
, genInstanceSmallerThanNode
, Instance.Instance(..)
) where
Instance.movable inst' ==? m
where inst' = Instance.setMovable inst m
-testSuite "Instance"
+testSuite "HTools/Instance"
[ 'prop_creat
, 'prop_setIdx
, 'prop_setName
-}
-module Test.Ganeti.HTools.Loader (testLoader) where
+module Test.Ganeti.HTools.Loader (testHTools_Loader) where
import Test.QuickCheck
BasicTypes.compareNameComponent (s1 ++ "." ++ s2) s1 ==
BasicTypes.LookupResult BasicTypes.PartialMatch s1
-testSuite "Loader"
+testSuite "HTools/Loader"
[ 'prop_lookupNode
, 'prop_lookupInstance
, 'prop_assignIndices
-}
module Test.Ganeti.HTools.Node
- ( testNode
+ ( testHTools_Node
, Node.Node(..)
, setInstanceSmallerThanNode
, genNode
Types.OpGood node' -> Node.removeSec node' inst'' ==? node
_ -> failTest "Can't add instance"
-testSuite "Node"
+testSuite "HTools/Node"
[ 'prop_setAlias
, 'prop_setOffline
, 'prop_setMcpu
-}
-module Test.Ganeti.HTools.PeerMap (testPeerMap) where
+module Test.Ganeti.HTools.PeerMap (testHTools_PeerMap) where
import Test.QuickCheck
where puniq = PeerMap.accumArray const pmap
-- | List of tests for the PeerMap module.
-testSuite "PeerMap"
+testSuite "HTools/PeerMap"
[ 'prop_addIdempotent
, 'prop_removeIdempotent
, 'prop_maxElem
-}
-module Test.Ganeti.HTools.Simu (testSimu) where
+module Test.Ganeti.HTools.Simu (testHTools_Simu) where
import Test.QuickCheck
map Group.iPolicy (Container.elems gl) ==?
replicate ngroups Types.defIPolicy
-testSuite "Simu"
+testSuite "HTools/Simu"
[ 'prop_Load
]
-}
-module Test.Ganeti.HTools.Text (testText) where
+module Test.Ganeti.HTools.Text (testHTools_Text) where
import Test.QuickCheck
defGroupList ==? gl2 .&&.
nl' ==? nl2
-testSuite "Text"
+testSuite "HTools/Text"
[ 'prop_Load_Instance
, 'prop_Load_InstanceFail
, 'prop_Load_Node
-}
module Test.Ganeti.HTools.Types
- ( testTypes
+ ( testHTools_Types
, Types.AllocPolicy(..)
, Types.DiskTemplate(..)
, Types.FailMode(..)
Types.Ok v' -> v == v'
where r = Types.eitherToResult ei
-testSuite "Types"
+testSuite "HTools/Types"
[ 'prop_AllocPolicy_serialisation
, 'prop_DiskTemplate_serialisation
, 'prop_ISpec_serialisation
-}
-module Test.Ganeti.HTools.Utils (testUtils) where
+module Test.Ganeti.HTools.Utils (testHTools_Utils) where
import Test.QuickCheck
n_tb = n_gb * 1000
-- | Test list for the Utils module.
-testSuite "Utils"
+testSuite "HTools/Utils"
[ 'prop_commaJoinSplit
, 'prop_commaSplitJoin
, 'prop_fromObjWithDefault
-}
module Test.Ganeti.Query.Language
- ( testQlang
+ ( testQuery_Language
, genFilter
) where
(J.readJSON (J.showJSON rex) ==? J.Ok rex) .&&.
printTestCase "failed read/show instances" (read (show rex) ==? rex)
-testSuite "Qlang"
+testSuite "Query/Language"
[ 'prop_Serialisation
, 'prop_FilterRegex_instances
]
| casePrefix `isPrefixOf` str -> [| runCase $strE $nameE |]
| otherwise -> fail $ "Unsupported test function name '" ++ str ++ "'"
+-- | Convert slashes in a name to underscores.
+mapSlashes :: String -> String
+mapSlashes = map (\c -> if c == '/' then '_' else c)
+
-- | Builds a test suite.
testSuite :: String -> [Name] -> Q [Dec]
testSuite tsname tdef = do
- let fullname = mkName $ "test" ++ tsname
+ let fullname = mkName $ "test" ++ mapSlashes tsname
tests <- mapM run tdef
sigtype <- [t| (String, [Test]) |]
return [ SigD fullname sigtype
-- | All our defined tests.
allTests :: [(Bool, (String, [Test]))]
allTests =
- [ (True, testUtils)
- , (True, testPeerMap)
- , (True, testContainer)
- , (True, testInstance)
- , (True, testNode)
- , (True, testText)
- , (True, testSimu)
- , (True, testOpCodes)
- , (True, testJobs)
- , (True, testLoader)
- , (True, testTypes)
- , (True, testCLI)
+ [ (True, testConfd_Utils)
+ , (True, testHTools_CLI)
+ , (True, testHTools_Container)
+ , (True, testHTools_Instance)
+ , (True, testHTools_Loader)
+ , (True, testHTools_Node)
+ , (True, testHTools_PeerMap)
+ , (True, testHTools_Simu)
+ , (True, testHTools_Text)
+ , (True, testHTools_Types)
+ , (True, testHTools_Utils)
, (True, testJSON)
+ , (True, testJobs)
, (True, testLuxi)
- , (True, testSsconf)
- , (True, testQlang)
- , (True, testRpc)
- , (True, testConfdUtils)
, (True, testObjects)
- , (False, testCluster)
+ , (True, testOpCodes)
+ , (True, testQuery_Language)
+ , (True, testRpc)
+ , (True, testSsconf)
+ , (False, testHTools_Cluster)
]
-- | Slow a test's max tests, if provided as such.