Commit dd11dad4 authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Make integration test suite more robust

Make integration test suite more robust:
  * Support testing only individual images
  * Mark yet un-tested options as "EXPERIMENTAL"
  * Rename integration test suite to "burnin",
    name shamelessly stolen from the corresponding Ganeti tool
parent a6f5f301
......@@ -76,7 +76,7 @@ SNF_TEST_PREFIX = "snf-test-"
# Setup logging (FIXME - verigak)
log = logging.getLogger("snf-test")
log = logging.getLogger("burnin")
......@@ -233,7 +233,6 @@ class SpawnServerTestCase(unittest.TestCase):
def _verify_server_status(self, current_status, new_status):
"""Verify a server has switched to a specified status"""
server = self.client.get_server_details(self.serverid)
self.assertIn(server["status"], (current_status, new_status))
if server["status"] not in (current_status, new_status):
return None # Do not raise exception, return so the test fails
self.assertEquals(server["status"], new_status)
......@@ -584,16 +583,14 @@ def _run_cases_in_parallel(cases, fanout=1, runner=None):
The cases iterable specifies the TestCases to be executed in parallel,
by test runners running in distinct processes.
The fanout parameter specifies the number of processes to spawn,
and defaults to 1.
The runner argument specifies the test runner class to use inside each
runner process.
if runner is None:
runner = unittest.TextTestRunner()
runner = unittest.TextTestRunner(verbosity=2, failfast=True)
# testq: The master process enqueues TestCase objects into this queue,
# test runner processes pick them up for execution, in parallel.
......@@ -677,9 +674,10 @@ def parse_arguments(args):
action="store", type="string", dest="token",
help="The token to use for authentication to the API",
action="store_true", dest="failfast",
help="Fail immediately if one of the tests fails",
action="store_true", dest="nofailfast",
help="Do not fail immediately if one of the tests " \
action="store", type="int", dest="action_timeout",
......@@ -710,7 +708,7 @@ def parse_arguments(args):
help="Spawn up to COUNT child processes to execute " \
"in parallel, essentially have up to COUNT " \
"server build requests outstanding",
"server build requests outstanding (EXPERIMENTAL)",
action="store", type="int", dest="force_flavorid",
......@@ -718,7 +716,13 @@ def parse_arguments(args):
help="Force all server creations to use the specified "\
"FLAVOR ID instead of a randomly chosen one, " \
"useful if disk space is scarce",
default=None) # FIXME
action="store", type="int", dest="force_imageid",
metavar="IMAGE ID",
help="Instead of testing all available images, test " \
"only the specified IMAGE ID",
action="store_true", dest="show_stale",
help="Show stale servers from previous runs, whose "\
......@@ -773,7 +777,7 @@ def main():
# Run them: FIXME: In parallel, FAILEARLY, catchbreak?
#unittest.main(verbosity=2, catchbreak=True)
runner = unittest.TextTestRunner(verbosity=2, failfast=opts.failfast)
runner = unittest.TextTestRunner(verbosity=2, failfast=not opts.nofailfast)
# The following cases run sequentially
seq_cases = [UnauthorizedTestCase, FlavorsTestCase, ImagesTestCase]
_run_cases_in_parallel(seq_cases, fanout=3, runner=runner)
......@@ -781,7 +785,12 @@ def main():
# The following cases run in parallel
par_cases = []
for image in DIMAGES:
if opts.force_imageid:
test_images = filter(lambda x: x["id"] == opts.force_imageid, DIMAGES)
test_images = DIMAGES
for image in test_images:
imageid = image["id"]
imagename = image["name"]
if opts.force_flavorid:
......@@ -802,8 +811,6 @@ def main():
print "%s" % FlavorsTestCase
print "dict", __main__.__dict__
_run_cases_in_parallel(par_cases, fanout=opts.fanout, runner=runner)
if __name__ == "__main__":
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