self.run_cmd = ''
self.network_extensions = []
- def _build_task_args(self, test_file_name):
+ def build_task_args(self, test_name):
"""Build arguments for the Rally task."""
- task_args = {'service_list': [test_file_name]}
+ task_args = {'service_list': [test_name]}
task_args['image_name'] = str(self.image.name)
task_args['flavor_name'] = str(self.flavor.name)
task_args['flavor_alt_name'] = str(self.flavor_alt.name)
return False
self.run_cmd = (["rally", "task", "start", "--abort-on-sla-failure",
"--task", self.task_file, "--task-args",
- str(self._build_task_args(test_name))])
+ str(self.build_task_args(test_name))])
return True
def run_tests(self):
with open(result_file_name, 'w') as fname:
template.dump(cases, fname)
+ def build_task_args(self, test_name):
+ """Build arguments for the Rally task."""
+ task_args = {}
+ if self.ext_net:
+ task_args['floating_network'] = str(self.ext_net.name)
+ else:
+ task_args['floating_network'] = ''
+ return task_args
+
@staticmethod
def _remove_plugins_extra():
inst_dir = getattr(config.CONF, 'dir_rally_inst')
os.makedirs(self.TEMP_DIR)
task_file_name = os.path.join(self.TEMP_DIR, task_name)
self.apply_blacklist(task, task_file_name)
- self.run_cmd = (["rally", "task", "start", "--task", task_file_name])
+ self.run_cmd = (["rally", "task", "start", "--task", task_file_name,
+ "--task-args", str(self.build_task_args(test_name))])
return True
def clean(self):
def test_build_task_args_missing_floating_network(self):
os.environ['OS_AUTH_URL'] = ''
self.rally_base.ext_net = None
- task_args = self.rally_base._build_task_args('test_file_name')
+ task_args = self.rally_base.build_task_args('test_name')
self.assertEqual(task_args['floating_network'], '')
def test_build_task_args_missing_net_id(self):
os.environ['OS_AUTH_URL'] = ''
self.rally_base.network = None
- task_args = self.rally_base._build_task_args('test_file_name')
+ task_args = self.rally_base.build_task_args('test_name')
self.assertEqual(task_args['netid'], '')
@staticmethod
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'file_is_empty', return_value=False)
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
- '_build_task_args', return_value={})
+ 'build_task_args', return_value={})
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'get_task_id', return_value=None)
@mock.patch('functest.opnfv_tests.openstack.rally.rally.os.path.exists',
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'file_is_empty', return_value=False)
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
- '_build_task_args', return_value={})
+ 'build_task_args', return_value={})
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'
'get_task_id', return_value='1')
@mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.'