Skip to content
Snippets Groups Projects
Commit 44be51aa authored by Iustin Pop's avatar Iustin Pop
Browse files

Remove the slow/fast tests functionality


Since the recent commits improved the speed of the two "slow" test
groups to regular test speed, we can remove this kludge and simplify
significantly our test runner, yay!

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent c3a8e06d
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
module Test.Ganeti.Objects
( testObjects
, testSlowObjects
, Hypervisor(..)
, Node(..)
, genEmptyCluster
......@@ -234,8 +233,5 @@ testSuite "Objects"
, 'prop_Disk_serialisation
, 'prop_Inst_serialisation
, 'prop_Node_serialisation
]
testSuite "SlowObjects"
[ 'prop_Config_serialisation
, 'prop_Config_serialisation
]
......@@ -57,9 +57,9 @@ import Test.Ganeti.Rpc
import Test.Ganeti.Ssconf
-- | Our default test options, overring the built-in test-framework
-- ones.
fast :: TestOptions
fast = TestOptions
-- ones (but not the supplied command line parameters).
defOpts :: TestOptions
defOpts = TestOptions
{ topt_seed = Nothing
, topt_maximum_generated_tests = Just 500
, topt_maximum_unsuitable_generated_tests = Just 5000
......@@ -68,72 +68,41 @@ fast = TestOptions
, topt_timeout = Nothing
}
-- | Our slow test options.
slow :: TestOptions
slow = fast
{ topt_maximum_generated_tests = Just 50
, topt_maximum_unsuitable_generated_tests = Just 500
}
-- | All our defined tests.
allTests :: [(Bool, (String, [Test]))]
allTests :: [(String, [Test])]
allTests =
[ (True, testBasicTypes)
, (True, testConfd_Utils)
, (True, testCommon)
, (True, testDaemon)
, (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, testObjects)
, (True, testOpCodes)
, (True, testQuery_Filter)
, (True, testQuery_Language)
, (True, testQuery_Query)
, (True, testRpc)
, (True, testSsconf)
, (False, testHTools_Cluster)
, (False, testSlowObjects)
[ testBasicTypes
, testCommon
, testConfd_Utils
, testDaemon
, testHTools_CLI
, testHTools_Cluster
, testHTools_Container
, testHTools_Instance
, testHTools_Loader
, testHTools_Node
, testHTools_PeerMap
, testHTools_Simu
, testHTools_Text
, testHTools_Types
, testHTools_Utils
, testJSON
, testJobs
, testLuxi
, testObjects
, testOpCodes
, testQuery_Filter
, testQuery_Language
, testQuery_Query
, testRpc
, testSsconf
]
-- | Slow a test's max tests, if provided as such.
makeSlowOrFast :: Bool -> TestOptions -> TestOptions
makeSlowOrFast is_fast opts =
let template = if is_fast then fast else slow
fn_val v = if is_fast then v else v `div` 10
in case topt_maximum_generated_tests opts of
-- user didn't override the max_tests, so we'll do it here
Nothing -> opts `mappend` template
-- user did override, so we ignore the template and just directly
-- decrease the max_tests, if needed
Just max_tests -> opts { topt_maximum_generated_tests =
Just (fn_val max_tests)
}
-- | Main function. Note we don't use defaultMain since we want to
-- control explicitly our test sizes (and override the default).
main :: IO ()
main = do
ropts <- getArgs >>= interpretArgsOrExit
-- note: we do this overriding here since we need some groups to
-- have a smaller test count; so in effect we're basically
-- overriding t-f's inheritance here, but only for max_tests
let (act_fast, act_slow) =
case ropt_test_options ropts of
Nothing -> (fast, slow)
Just topts -> (makeSlowOrFast True topts, makeSlowOrFast False topts)
actual_opts is_fast = if is_fast then act_fast else act_slow
let tests = map (\(is_fast, (group_name, group_tests)) ->
plusTestOptions (actual_opts is_fast) $
testGroup group_name group_tests) allTests
defaultMainWithOpts tests ropts
let opts = maybe defOpts (defOpts `mappend`) $ ropt_test_options ropts
tests = map (uncurry testGroup) allTests
defaultMainWithOpts tests (ropts { ropt_test_options = Just opts })
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment