format deployAndRun

This commit is contained in:
Daan Hoogland 2013-06-21 11:38:53 +02:00 committed by Sebastien Goasguen
parent a401127b0d
commit 16e4f2ff72
1 changed files with 30 additions and 23 deletions

View File

@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@ -22,46 +22,53 @@ if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("-d", "--directory", dest="testCaseFolder", help="the test case directory")
parser.add_argument("-f", "--file", dest="module", help="run tests in the given file")
parser.add_argument("-r", "--result", dest="result", help="test result log file", default='/tmp/t.log')
parser.add_argument("-t", "--client", dest="testcaselog", help="test case log file", default='/tmp/r.log')
parser.add_argument("-c", "--config", action="store", default="./datacenterCfg", dest="config",
help="the path where the json config file generated, by default is ./datacenterCfg")
parser.add_argument("-d", "--directory", dest="testCaseFolder",
help="the test case directory")
parser.add_argument("-f", "--file", dest="module",
help="run tests in the given file")
parser.add_argument("-r", "--result", dest="result",
help="test result log file", default='/tmp/t.log')
parser.add_argument("-t", "--client", dest="testcaselog",
help="test case log file", default='/tmp/r.log')
parser.add_argument("-c", "--config", action="store",
default="./datacenterCfg", dest="config",
help="the path where the json config file generated,\
by default is ./datacenterCfg")
parser.add_argument("-l", "--load", dest="load", action="store_true",
help="only load config, do not deploy, it will only run testcase")
help="only load config, do not deploy,\
it will only run testcase")
options = parser.parse_args()
testResultLogFile = None
if options.result is not None:
testResultLogFile = options.result
testCaseLogFile = None
if options.testcaselog is not None:
testCaseLogFile = options.testcaselog
deploy = deployDataCenter.deployDataCenters(options.config)
deploy = deployDataCenter.deployDataCenters(options.config)
if options.load:
deploy.loadCfg()
else:
deploy.deploy()
if options.testCaseFolder is None:
if options.module is None:
parser.print_usage()
exit(1)
else:
engine = \
TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
deploy.getCfg(),
testCaseLogFile,
testResultLogFile)
engine.loadTestsFromFile(options.module)
engine.run()
else:
engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
engine = \
TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
deploy.getCfg(),
testCaseLogFile,
testResultLogFile)
engine.loadTestsFromDir(options.testCaseFolder)
engine.run()
engine.loadTestsFromFile(options.module)
engine.run()
else:
engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient,
deploy.getCfg(),
testCaseLogFile,
testResultLogFile)
engine.loadTestsFromDir(options.testCaseFolder)
engine.run()