3 # Copyright (c) 2015 All rights reserved
4 # This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # 0.1: This script boots the VM1 and allocates IP address from Nova
11 # Later, the VM2 boots then execute cloud-init to ping VM1.
12 # After successful ping, both the VMs are deleted.
13 # 0.2: measure test duration and publish results under json format
14 # 0.3: add report flag to push results when needed
15 # 0.4: refactoring to match Test abstraction class
22 import functest.core.testcase_base as testcase_base
23 import functest.utils.functest_constants as ft_constants
24 import functest.utils.functest_logger as ft_logger
25 import functest.utils.functest_utils as ft_utils
28 class DominoCases(testcase_base.TestcaseBase):
30 ft_constants.DOMINO_REPO_DIR
32 ft_constants.FUNCTEST_RESULTS_DIR
33 logger = ft_logger.Logger("domino").getLogger()
36 super(DominoCases, self).__init__()
37 self.project_name = "domino"
38 self.case_name = "domino-multinode"
40 def main(self, **kwargs):
41 cmd = 'cd %s && ./tests/run_multinode.sh' % self.DOMINO_REPO
42 log_file = os.path.join(self.RESULTS_DIR, "domino.log")
43 start_time = time.time()
45 ret = ft_utils.execute_command(cmd,
48 stop_time = time.time()
50 self.logger.info("domino OK")
53 self.logger.info("domino FAILED")
56 # report status only if tests run (FAIL OR PASS)
57 self.criteria = status
58 self.start_time = start_time
59 self.stop_time = stop_time
64 return self.main(**kwargs)
66 if __name__ == '__main__':
67 parser = argparse.ArgumentParser()
68 parser.add_argument("-r", "--report",
69 help="Create json result file",
71 args = vars(parser.parse_args())
72 domino = DominoCases()
74 result = domino.main(**args)
75 if result != testcase_base.TestcaseBase.EX_OK:
78 sys.exit(domino.push_to_db())
80 sys.exit(testcase_base.TestcaseBase.EX_RUN_ERROR)