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

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 ...@@ -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 Control.Applicative
import Test.QuickCheck import Test.QuickCheck
...@@ -105,7 +105,7 @@ prop_bad_key salt crq = ...@@ -105,7 +105,7 @@ prop_bad_key salt crq =
BasicTypes.Bad "HMAC verification failed" ==? BasicTypes.Bad "HMAC verification failed" ==?
Confd.Utils.parseRequest key_verify encoded Confd.Utils.parseRequest key_verify encoded
testSuite "ConfdUtils" testSuite "Confd/Utils"
[ 'prop_req_sign [ 'prop_req_sign
, 'prop_bad_key , 'prop_bad_key
] ]
...@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 import Test.QuickCheck
...@@ -116,7 +116,7 @@ prop_stdopts = ...@@ -116,7 +116,7 @@ prop_stdopts =
-- apply checkEarlyExit across the cartesian product of params and opts -- apply checkEarlyExit across the cartesian product of params and opts
in conjoin [checkEarlyExit n o p | p <- params, (n, o) <- opts] in conjoin [checkEarlyExit n o p | p <- params, (n, o) <- opts]
testSuite "CLI" testSuite "HTools/CLI"
[ 'prop_parseISpec [ 'prop_parseISpec
, 'prop_parseISpecFail , 'prop_parseISpecFail
, 'prop_parseYesNo , 'prop_parseYesNo
......
...@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 import Test.QuickCheck
...@@ -352,7 +352,7 @@ prop_AllocPolicy node = ...@@ -352,7 +352,7 @@ prop_AllocPolicy node =
nl = makeSmallCluster node' count nl = makeSmallCluster node' count
in not $ canAllocOn nl rqn inst in not $ canAllocOn nl rqn inst
testSuite "Cluster" testSuite "HTools/Cluster"
[ 'prop_Score_Zero [ 'prop_Score_Zero
, 'prop_CStats_sane , 'prop_CStats_sane
, 'prop_Alloc_sane , 'prop_Alloc_sane
......
...@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 import Test.QuickCheck
...@@ -79,7 +79,7 @@ prop_findByName = ...@@ -79,7 +79,7 @@ prop_findByName =
printTestCase "Found non-existing name" printTestCase "Found non-existing name"
(isNothing (Container.findByName nl' othername)) (isNothing (Container.findByName nl' othername))
testSuite "Container" testSuite "HTools/Container"
[ 'prop_addTwo [ 'prop_addTwo
, 'prop_nameOf , 'prop_nameOf
, 'prop_findByName , 'prop_findByName
......
...@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-} -}
module Test.Ganeti.HTools.Instance module Test.Ganeti.HTools.Instance
( testInstance ( testHTools_Instance
, genInstanceSmallerThanNode , genInstanceSmallerThanNode
, Instance.Instance(..) , Instance.Instance(..)
) where ) where
...@@ -151,7 +151,7 @@ prop_setMovable inst m = ...@@ -151,7 +151,7 @@ prop_setMovable inst m =
Instance.movable inst' ==? m Instance.movable inst' ==? m
where inst' = Instance.setMovable inst m where inst' = Instance.setMovable inst m
testSuite "Instance" testSuite "HTools/Instance"
[ 'prop_creat [ 'prop_creat
, 'prop_setIdx , 'prop_setIdx
, 'prop_setName , 'prop_setName
......
...@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 import Test.QuickCheck
...@@ -95,7 +95,7 @@ prop_compareNameComponent_prefix (NonEmpty s1) s2 = ...@@ -95,7 +95,7 @@ prop_compareNameComponent_prefix (NonEmpty s1) s2 =
BasicTypes.compareNameComponent (s1 ++ "." ++ s2) s1 == BasicTypes.compareNameComponent (s1 ++ "." ++ s2) s1 ==
BasicTypes.LookupResult BasicTypes.PartialMatch s1 BasicTypes.LookupResult BasicTypes.PartialMatch s1
testSuite "Loader" testSuite "HTools/Loader"
[ 'prop_lookupNode [ 'prop_lookupNode
, 'prop_lookupInstance , 'prop_lookupInstance
, 'prop_assignIndices , 'prop_assignIndices
......
...@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-} -}
module Test.Ganeti.HTools.Node module Test.Ganeti.HTools.Node
( testNode ( testHTools_Node
, Node.Node(..) , Node.Node(..)
, setInstanceSmallerThanNode , setInstanceSmallerThanNode
, genNode , genNode
...@@ -289,7 +289,7 @@ prop_addSec_idempotent = ...@@ -289,7 +289,7 @@ prop_addSec_idempotent =
Types.OpGood node' -> Node.removeSec node' inst'' ==? node Types.OpGood node' -> Node.removeSec node' inst'' ==? node
_ -> failTest "Can't add instance" _ -> failTest "Can't add instance"
testSuite "Node" testSuite "HTools/Node"
[ 'prop_setAlias [ 'prop_setAlias
, 'prop_setOffline , 'prop_setOffline
, 'prop_setMcpu , 'prop_setMcpu
......
...@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 import Test.QuickCheck
...@@ -71,7 +71,7 @@ prop_maxElem pmap = ...@@ -71,7 +71,7 @@ prop_maxElem pmap =
where puniq = PeerMap.accumArray const pmap where puniq = PeerMap.accumArray const pmap
-- | List of tests for the PeerMap module. -- | List of tests for the PeerMap module.
testSuite "PeerMap" testSuite "HTools/PeerMap"
[ 'prop_addIdempotent [ 'prop_addIdempotent
, 'prop_removeIdempotent , 'prop_removeIdempotent
, 'prop_maxElem , 'prop_maxElem
......
...@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 import Test.QuickCheck
...@@ -92,6 +92,6 @@ prop_Load = ...@@ -92,6 +92,6 @@ prop_Load =
map Group.iPolicy (Container.elems gl) ==? map Group.iPolicy (Container.elems gl) ==?
replicate ngroups Types.defIPolicy replicate ngroups Types.defIPolicy
testSuite "Simu" testSuite "HTools/Simu"
[ 'prop_Load [ 'prop_Load
] ]
...@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 import Test.QuickCheck
...@@ -199,7 +199,7 @@ prop_CreateSerialise = ...@@ -199,7 +199,7 @@ prop_CreateSerialise =
defGroupList ==? gl2 .&&. defGroupList ==? gl2 .&&.
nl' ==? nl2 nl' ==? nl2
testSuite "Text" testSuite "HTools/Text"
[ 'prop_Load_Instance [ 'prop_Load_Instance
, 'prop_Load_InstanceFail , 'prop_Load_InstanceFail
, 'prop_Load_Node , 'prop_Load_Node
......
...@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-} -}
module Test.Ganeti.HTools.Types module Test.Ganeti.HTools.Types
( testTypes ( testHTools_Types
, Types.AllocPolicy(..) , Types.AllocPolicy(..)
, Types.DiskTemplate(..) , Types.DiskTemplate(..)
, Types.FailMode(..) , Types.FailMode(..)
...@@ -175,7 +175,7 @@ prop_eitherToResult ei = ...@@ -175,7 +175,7 @@ prop_eitherToResult ei =
Types.Ok v' -> v == v' Types.Ok v' -> v == v'
where r = Types.eitherToResult ei where r = Types.eitherToResult ei
testSuite "Types" testSuite "HTools/Types"
[ 'prop_AllocPolicy_serialisation [ 'prop_AllocPolicy_serialisation
, 'prop_DiskTemplate_serialisation , 'prop_DiskTemplate_serialisation
, 'prop_ISpec_serialisation , 'prop_ISpec_serialisation
......
...@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -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 import Test.QuickCheck
...@@ -120,7 +120,7 @@ prop_parseUnit (NonNegative n) = ...@@ -120,7 +120,7 @@ prop_parseUnit (NonNegative n) =
n_tb = n_gb * 1000 n_tb = n_gb * 1000
-- | Test list for the Utils module. -- | Test list for the Utils module.
testSuite "Utils" testSuite "HTools/Utils"
[ 'prop_commaJoinSplit [ 'prop_commaJoinSplit
, 'prop_commaSplitJoin , 'prop_commaSplitJoin
, 'prop_fromObjWithDefault , 'prop_fromObjWithDefault
......
...@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-} -}
module Test.Ganeti.Query.Language module Test.Ganeti.Query.Language
( testQlang ( testQuery_Language
, genFilter , genFilter
) where ) where
...@@ -92,7 +92,7 @@ prop_FilterRegex_instances rex = ...@@ -92,7 +92,7 @@ prop_FilterRegex_instances rex =
(J.readJSON (J.showJSON rex) ==? J.Ok rex) .&&. (J.readJSON (J.showJSON rex) ==? J.Ok rex) .&&.
printTestCase "failed read/show instances" (read (show rex) ==? rex) printTestCase "failed read/show instances" (read (show rex) ==? rex)
testSuite "Qlang" testSuite "Query/Language"
[ 'prop_Serialisation [ 'prop_Serialisation
, 'prop_FilterRegex_instances , 'prop_FilterRegex_instances
] ]
...@@ -70,10 +70,14 @@ run name = ...@@ -70,10 +70,14 @@ run name =
| casePrefix `isPrefixOf` str -> [| runCase $strE $nameE |] | casePrefix `isPrefixOf` str -> [| runCase $strE $nameE |]
| otherwise -> fail $ "Unsupported test function name '" ++ str ++ "'" | 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. -- | Builds a test suite.
testSuite :: String -> [Name] -> Q [Dec] testSuite :: String -> [Name] -> Q [Dec]
testSuite tsname tdef = do testSuite tsname tdef = do
let fullname = mkName $ "test" ++ tsname let fullname = mkName $ "test" ++ mapSlashes tsname
tests <- mapM run tdef tests <- mapM run tdef
sigtype <- [t| (String, [Test]) |] sigtype <- [t| (String, [Test]) |]
return [ SigD fullname sigtype return [ SigD fullname sigtype
......
...@@ -73,26 +73,26 @@ slow = fast ...@@ -73,26 +73,26 @@ slow = fast
-- | All our defined tests. -- | All our defined tests.
allTests :: [(Bool, (String, [Test]))] allTests :: [(Bool, (String, [Test]))]
allTests = allTests =
[ (True, testUtils) [ (True, testConfd_Utils)
, (True, testPeerMap) , (True, testHTools_CLI)
, (True, testContainer) , (True, testHTools_Container)
, (True, testInstance) , (True, testHTools_Instance)
, (True, testNode) , (True, testHTools_Loader)
, (True, testText) , (True, testHTools_Node)
, (True, testSimu) , (True, testHTools_PeerMap)
, (True, testOpCodes) , (True, testHTools_Simu)
, (True, testJobs) , (True, testHTools_Text)
, (True, testLoader) , (True, testHTools_Types)
, (True, testTypes) , (True, testHTools_Utils)
, (True, testCLI)
, (True, testJSON) , (True, testJSON)
, (True, testJobs)
, (True, testLuxi) , (True, testLuxi)
, (True, testSsconf)
, (True, testQlang)
, (True, testRpc)
, (True, testConfdUtils)
, (True, testObjects) , (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. -- | 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