Commit e09c1fa0 authored by Iustin Pop's avatar Iustin Pop

Fixup test suite names

The names were not in a proper hierarchy, leading to inconsistencies
about what they were actually tested.

We change this by reproducing in the test names the relative hierarchy
within the Ganeti directory, leading to nicer test suite names (in
test-framework output).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 20bc5360
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.Confd.Utils (testConfdUtils) where
module Test.Ganeti.Confd.Utils (testConfd_Utils) where
import Control.Applicative
import Test.QuickCheck
......@@ -105,7 +105,7 @@ prop_bad_key salt crq =
BasicTypes.Bad "HMAC verification failed" ==?
Confd.Utils.parseRequest key_verify encoded
testSuite "ConfdUtils"
testSuite "Confd/Utils"
[ 'prop_req_sign
, 'prop_bad_key
]
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.CLI (testCLI) where
module Test.Ganeti.HTools.CLI (testHTools_CLI) where
import Test.QuickCheck
......@@ -116,7 +116,7 @@ prop_stdopts =
-- 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
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Cluster (testCluster) where
module Test.Ganeti.HTools.Cluster (testHTools_Cluster) where
import Test.QuickCheck
......@@ -352,7 +352,7 @@ prop_AllocPolicy node =
nl = makeSmallCluster node' count
in not $ canAllocOn nl rqn inst
testSuite "Cluster"
testSuite "HTools/Cluster"
[ 'prop_Score_Zero
, 'prop_CStats_sane
, 'prop_Alloc_sane
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Container (testContainer) where
module Test.Ganeti.HTools.Container (testHTools_Container) where
import Test.QuickCheck
......@@ -79,7 +79,7 @@ prop_findByName =
printTestCase "Found non-existing name"
(isNothing (Container.findByName nl' othername))
testSuite "Container"
testSuite "HTools/Container"
[ 'prop_addTwo
, 'prop_nameOf
, 'prop_findByName
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Instance
( testInstance
( testHTools_Instance
, genInstanceSmallerThanNode
, Instance.Instance(..)
) where
......@@ -151,7 +151,7 @@ prop_setMovable inst m =
Instance.movable inst' ==? m
where inst' = Instance.setMovable inst m
testSuite "Instance"
testSuite "HTools/Instance"
[ 'prop_creat
, 'prop_setIdx
, 'prop_setName
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Loader (testLoader) where
module Test.Ganeti.HTools.Loader (testHTools_Loader) where
import Test.QuickCheck
......@@ -95,7 +95,7 @@ prop_compareNameComponent_prefix (NonEmpty s1) s2 =
BasicTypes.compareNameComponent (s1 ++ "." ++ s2) s1 ==
BasicTypes.LookupResult BasicTypes.PartialMatch s1
testSuite "Loader"
testSuite "HTools/Loader"
[ 'prop_lookupNode
, 'prop_lookupInstance
, 'prop_assignIndices
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Node
( testNode
( testHTools_Node
, Node.Node(..)
, setInstanceSmallerThanNode
, genNode
......@@ -289,7 +289,7 @@ prop_addSec_idempotent =
Types.OpGood node' -> Node.removeSec node' inst'' ==? node
_ -> failTest "Can't add instance"
testSuite "Node"
testSuite "HTools/Node"
[ 'prop_setAlias
, 'prop_setOffline
, 'prop_setMcpu
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.PeerMap (testPeerMap) where
module Test.Ganeti.HTools.PeerMap (testHTools_PeerMap) where
import Test.QuickCheck
......@@ -71,7 +71,7 @@ prop_maxElem pmap =
where puniq = PeerMap.accumArray const pmap
-- | List of tests for the PeerMap module.
testSuite "PeerMap"
testSuite "HTools/PeerMap"
[ 'prop_addIdempotent
, 'prop_removeIdempotent
, 'prop_maxElem
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Simu (testSimu) where
module Test.Ganeti.HTools.Simu (testHTools_Simu) where
import Test.QuickCheck
......@@ -92,6 +92,6 @@ prop_Load =
map Group.iPolicy (Container.elems gl) ==?
replicate ngroups Types.defIPolicy
testSuite "Simu"
testSuite "HTools/Simu"
[ 'prop_Load
]
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Text (testText) where
module Test.Ganeti.HTools.Text (testHTools_Text) where
import Test.QuickCheck
......@@ -199,7 +199,7 @@ prop_CreateSerialise =
defGroupList ==? gl2 .&&.
nl' ==? nl2
testSuite "Text"
testSuite "HTools/Text"
[ 'prop_Load_Instance
, 'prop_Load_InstanceFail
, 'prop_Load_Node
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Types
( testTypes
( testHTools_Types
, Types.AllocPolicy(..)
, Types.DiskTemplate(..)
, Types.FailMode(..)
......@@ -175,7 +175,7 @@ prop_eitherToResult ei =
Types.Ok v' -> v == v'
where r = Types.eitherToResult ei
testSuite "Types"
testSuite "HTools/Types"
[ 'prop_AllocPolicy_serialisation
, 'prop_DiskTemplate_serialisation
, 'prop_ISpec_serialisation
......
......@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.HTools.Utils (testUtils) where
module Test.Ganeti.HTools.Utils (testHTools_Utils) where
import Test.QuickCheck
......@@ -120,7 +120,7 @@ prop_parseUnit (NonNegative n) =
n_tb = n_gb * 1000
-- | Test list for the Utils module.
testSuite "Utils"
testSuite "HTools/Utils"
[ 'prop_commaJoinSplit
, 'prop_commaSplitJoin
, 'prop_fromObjWithDefault
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Test.Ganeti.Query.Language
( testQlang
( testQuery_Language
, genFilter
) where
......@@ -92,7 +92,7 @@ prop_FilterRegex_instances rex =
(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
]
......@@ -70,10 +70,14 @@ run name =
| 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
......
......@@ -73,26 +73,26 @@ slow = fast
-- | 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.
......
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