3 # This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
12 class TestCase(object):
14 def __init__(self, name, project, constraints,
15 criteria=-1, isRunnable=True, tier=-1):
17 self.project = project
18 self.constraints = constraints
19 self.criteria = criteria
20 self.isRunnable = isRunnable
22 display_name_matrix = {'healthcheck': 'healthcheck',
23 'vping_ssh': 'vPing (ssh)',
24 'vping_userdata': 'vPing (userdata)',
28 'tempest_smoke_serial': 'Tempest (smoke)',
29 'tempest_full_parallel': 'Tempest (full)',
30 'rally_sanity': 'Rally (smoke)',
32 'rally_full': 'Rally (full)',
38 'security_scan': 'security',
39 'multisite': 'multisite',
46 self.displayName = display_name_matrix[self.name]
48 self.displayName = "unknown"
56 def getConstraints(self):
57 return self.constraints
59 def getCriteria(self):
65 def setCriteria(self, criteria):
66 self.criteria = criteria
68 def setIsRunnable(self, isRunnable):
69 self.isRunnable = isRunnable
71 def checkRunnable(self, installer, scenario, config):
72 # Re-use Functest declaration
73 # Retrieve Functest configuration file functest_config.yaml
76 # print " *********************** "
78 # print " ---------------------- "
79 # print "case = " + self.name
80 # print "installer = " + installer
81 # print "scenario = " + scenario
82 # print "project = " + self.project
84 # Retrieve test constraints
85 # Retrieve test execution param
86 test_execution_context = {"installer": installer,
89 # By default we assume that all the tests are always runnable...
90 # if test_env not empty => dependencies to be checked
91 if config_test is not None and len(config_test) > 0:
92 # possible criteria = ["installer", "scenario"]
93 # consider test criteria from config file
94 # compare towards CI env through CI en variable
95 for criteria in config_test:
96 if re.search(config_test[criteria],
97 test_execution_context[criteria]) is None:
98 # print "Test "+ test + " cannot be run on the environment"
101 self.isRunnable = is_runnable
104 testcase = ("Name=" + self.name + ";Criteria=" +
105 str(self.criteria) + ";Project=" + self.project +
106 ";Constraints=" + str(self.constraints) +
107 ";IsRunnable" + str(self.isRunnable))
111 # Correspondance name of the test case / name in the DB
112 # ideally we should modify the DB to avoid such interface....
113 # '<name in the config>':'<name in the DB>'
114 # I know it is uggly...
115 test_match_matrix = {'healthcheck': 'healthcheck',
116 'vping_ssh': 'vping_ssh',
117 'vping_userdata': 'vping_userdata',
121 'tempest_smoke_serial': 'tempest_smoke_serial',
122 'tempest_full_parallel': 'tempest_full_parallel',
123 'rally_sanity': 'rally_sanity',
125 'rally_full': 'rally_full',
127 'doctor': 'doctor-notification',
128 'promise': 'promise',
130 'copper': 'copper-notification',
131 'security_scan': 'security',
132 'multisite': 'multisite',
133 'domino': 'domino-multinode',
134 'odl-sfc': 'odl-sfc',
135 'onos_sfc': 'onos_sfc',
136 'parser':'parser-basics'
139 return test_match_matrix[self.name]
143 def getDisplayName(self):
144 return self.displayName