Cleanup interface for default environment case
Project: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/commit/6545cc17 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/tree/6545cc17 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/diff/6545cc17 Branch: refs/heads/master Commit: 6545cc177b23d31ef8080d7718a66586bac40473 Parents: 9d29420 Author: Thomas Jackson <[email protected]> Authored: Mon Dec 22 18:01:35 2014 -0800 Committer: Thomas Jackson <[email protected]> Committed: Mon Dec 22 18:01:35 2014 -0800 ---------------------------------------------------------------------- tsqa/test_cases.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver-qa/blob/6545cc17/tsqa/test_cases.py ---------------------------------------------------------------------- diff --git a/tsqa/test_cases.py b/tsqa/test_cases.py index da73ffa..89ad203 100644 --- a/tsqa/test_cases.py +++ b/tsqa/test_cases.py @@ -20,13 +20,39 @@ class EnvironmentCase(unittest.TestCase): # call parent constructor super(EnvironmentCase, cls).setUpClass() + # get an environment + cls.environment = cls.getEnv() + + # call env setup, so people can change configs etc + cls.setUpEnv() + + # start ATS + cls.environment.start() + + @classmethod + def getEnv(cls): + ''' + This function is responsible for returning an environment. The default + is to build ATS and return a copy of an environment + ''' SOURCE_DIR = os.getenv('TSQA_SRC_DIR', '~/trafficserver') TMP_DIR = os.getenv('TSQA_TMP_DIR','/tmp/tsqa') ef = tsqa.environment.EnvironmentFactory(SOURCE_DIR, os.path.join(TMP_DIR, 'base_envs')) - cls.environment = ef.get_environment() + return ef.get_environment() + + @classmethod + def setUpEnv(cls): + ''' + This funciton is responsible for setting up the environment for this fixture + This includes everything pre-daemon start + ''' + pass @classmethod def tearDownClass(cls): + # stop ATS + cls.environment.stop() + # call parent destructor super(EnvironmentCase, cls).tearDownClass() cls.environment.destroy() # this will tear down any processes that we started
