Fixup test suite names
authorIustin Pop <iustin@google.com>
Wed, 29 Aug 2012 23:57:57 +0000 (01:57 +0200)
committerIustin Pop <iustin@google.com>
Wed, 5 Sep 2012 12:34:47 +0000 (14:34 +0200)
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: Iustin Pop <iustin@google.com>
Reviewed-by: RenĂ© Nussbaumer <rn@google.com>

15 files changed:
htest/Test/Ganeti/Confd/Utils.hs
htest/Test/Ganeti/HTools/CLI.hs
htest/Test/Ganeti/HTools/Cluster.hs
htest/Test/Ganeti/HTools/Container.hs
htest/Test/Ganeti/HTools/Instance.hs
htest/Test/Ganeti/HTools/Loader.hs
htest/Test/Ganeti/HTools/Node.hs
htest/Test/Ganeti/HTools/PeerMap.hs
htest/Test/Ganeti/HTools/Simu.hs
htest/Test/Ganeti/HTools/Text.hs
htest/Test/Ganeti/HTools/Types.hs
htest/Test/Ganeti/HTools/Utils.hs
htest/Test/Ganeti/Query/Language.hs
htest/Test/Ganeti/TestHelper.hs
htest/test.hs

index 4971389..1629f75 100644 (file)
@@ -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
   ]
index d357a61..b64e6ff 100644 (file)
@@ -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
index 349bf51..c26560e 100644 (file)
@@ -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
index d03a13e..9394fac 100644 (file)
@@ -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
index b31a16f..5c3ff14 100644 (file)
@@ -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
index 653744c..e02acf1 100644 (file)
@@ -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
index 1e44cf2..a437e64 100644 (file)
@@ -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
index 2b6f34f..c214271 100644 (file)
@@ -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
index 2960717..d113b18 100644 (file)
@@ -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
             ]
index d5ef290..844810b 100644 (file)
@@ -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
index 5eeaae2..6281fa5 100644 (file)
@@ -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
index eba69d1..c22c999 100644 (file)
@@ -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
index e2be679..ce2a3b7 100644 (file)
@@ -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
   ]
index 6b524c8..8a4fc25 100644 (file)
@@ -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
index 98cea39..cb0f2c8 100644 (file)
@@ -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.