in dns/py/runner.py [0:0]
def go(self):
"""
Run the performance tests.
"""
self._select_nodes()
test_cases = self.test_params.generate(self.attributes)
if len(test_cases) == 0:
_log.warning('No test cases')
return 0
try:
self._ensure_out_dir(test_cases[0].run_id)
client_pods=self._reset_client()
_log.info('Starting creation of test services')
self._create_test_services()
last_deploy_yaml = None
last_config_yaml = None
for test_case in test_cases:
try:
inputs = Inputs(self.deployment_yaml, self.configmap_yaml,
['/dnsperf', '-s', self.args.dns_ip])
test_case.configure(inputs)
# pin server to a specific node
inputs.deployment_yaml['spec']['template']['spec']['nodeName'] = \
self.server_node
if not self.use_existing and (
yaml.dump(inputs.deployment_yaml) !=
yaml.dump(last_deploy_yaml) or
yaml.dump(inputs.configmap_yaml) !=
yaml.dump(last_config_yaml)):
_log.info('Creating server with new parameters')
self._teardown()
self._create(inputs.deployment_yaml)
self._create(self.service_yaml)
if self.configmap_yaml is not None:
self._create(self.configmap_yaml)
self._wait_for_status(True)
test_threads=[]
#Spawn off a thread to run the test case in each client pod simultaneously.
for podname in client_pods:
_log.debug('Running test in pod %s', podname)
tc = copy.copy(test_case)
tc.pod_name = podname
dt = threading.Thread(target=self._run_perf,args=[tc,inputs, podname])
test_threads.append(dt)
dt.start()
for thread in test_threads:
thread.join()
last_deploy_yaml = inputs.deployment_yaml
last_config_yaml = inputs.configmap_yaml
except Exception:
_log.info('Exception caught during run, cleaning up. %s',
traceback.format_exc())
self._teardown()
self._teardown_client()
raise
finally:
self._teardown()
self._teardown_client()
if self.db is not None:
self.db.commit()
return 0