Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 1 | # Copyright 2018 Mirantis, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 15 | import json |
Oleksii Butenko | 71d76f3 | 2018-06-05 17:46:34 +0300 | [diff] [blame] | 16 | import os |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 17 | |
Oleksii Butenko | b0ca4cc | 2018-10-22 16:29:54 +0300 | [diff] [blame] | 18 | from devops.helpers import helpers |
| 19 | |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 20 | from tcp_tests import logger |
| 21 | from tcp_tests import settings |
| 22 | |
Oleksii Butenko | b0ca4cc | 2018-10-22 16:29:54 +0300 | [diff] [blame] | 23 | |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 24 | LOG = logger.logger |
| 25 | |
| 26 | TEMPEST_CFG_DIR = '/tmp/test' |
| 27 | |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 28 | |
| 29 | class RuntestManager(object): |
| 30 | """Helper manager for execution tempest via runtest-formula""" |
| 31 | |
| 32 | image_name = settings.TEMPEST_IMAGE |
| 33 | image_version = settings.TEMPEST_IMAGE_VERSION |
| 34 | container_name = 'run-tempest-ci' |
| 35 | master_host = "cfg01" |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 36 | control_host = "ctl01" |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 37 | class_name = "runtest" |
| 38 | run_cmd = '/bin/bash -c "run-tempest"' |
| 39 | |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 40 | def __init__(self, config, underlay, salt_api, cluster_name, |
Oleksii Butenko | 7456610 | 2018-09-11 11:55:13 +0300 | [diff] [blame] | 41 | domain_name, tempest_threads, |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 42 | tempest_pattern=settings.TEMPEST_PATTERN, |
| 43 | run_cmd=None, target='gtw01'): |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 44 | self.__config = config |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 45 | self.underlay = underlay |
| 46 | self.__salt_api = salt_api |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 47 | self.cluster_name = cluster_name |
| 48 | self.domain_name = domain_name |
| 49 | self.tempest_threads = tempest_threads |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 50 | self.tempest_pattern = tempest_pattern |
| 51 | self.run_cmd = run_cmd or self.run_cmd |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 52 | self.target_name = self.underlay.get_target_node_names(target)[0] |
| 53 | self.master_name = self.underlay.get_target_node_names( |
| 54 | self.master_host)[0] |
| 55 | self.control_name = self.underlay.get_target_node_names( |
| 56 | self.control_host)[0] |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 57 | |
| 58 | @property |
| 59 | def salt_api(self): |
| 60 | return self.__salt_api |
| 61 | |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 62 | @property |
| 63 | def runtest_pillar(self): |
| 64 | public_net = self.__config.underlay.dhcp_ranges[ |
| 65 | settings.EXTERNAL_ADDRESS_POOL_NAME] |
| 66 | public_gateway = public_net["gateway"].encode("ascii") |
| 67 | public_cidr = public_net["cidr"].encode("ascii") |
| 68 | public_allocation_start = public_net["start"].encode("ascii") |
| 69 | public_allocation_end = public_net["end"].encode("ascii") |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 70 | |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 71 | return { |
| 72 | 'classes': ['service.runtest.tempest', |
| 73 | 'service.runtest.tempest.public_net', |
| 74 | 'service.runtest.tempest.services.manila.glance'], |
| 75 | 'parameters': { |
| 76 | '_param': { |
| 77 | 'runtest_tempest_cfg_dir': TEMPEST_CFG_DIR, |
| 78 | 'runtest_tempest_cfg_name': 'tempest.conf', |
| 79 | 'runtest_tempest_public_net': 'public', |
| 80 | 'openstack_public_neutron_subnet_gateway': public_gateway, |
| 81 | 'openstack_public_neutron_subnet_cidr': public_cidr, |
| 82 | 'openstack_public_neutron_subnet_allocation_start': |
| 83 | public_allocation_start, |
| 84 | 'openstack_public_neutron_subnet_allocation_end': |
| 85 | public_allocation_end, |
| 86 | 'tempest_test_target': self.target_name.encode("ascii"), |
| 87 | }, |
| 88 | 'neutron': { |
| 89 | 'client': { |
| 90 | 'enabled': True |
| 91 | } |
| 92 | }, |
| 93 | 'runtest': { |
| 94 | 'enabled': True, |
| 95 | 'keystonerc_node': 'ctl01*', |
| 96 | 'tempest': { |
| 97 | 'enabled': True, |
| 98 | 'cfg_dir': '${_param:runtest_tempest_cfg_dir}', |
| 99 | 'cfg_name': '${_param:runtest_tempest_cfg_name}', |
Oleksii Butenko | 09cc0cd | 2018-10-16 14:31:57 +0300 | [diff] [blame] | 100 | 'put_keystone_rc_enabled': True, |
| 101 | 'put_local_image_file_enabled': False, |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 102 | 'DEFAULT': { |
| 103 | 'log_file': 'tempest.log' |
| 104 | }, |
| 105 | 'compute': { |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 106 | 'min_compute_nodes': 2, |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 107 | }, |
| 108 | 'convert_to_uuid': { |
| 109 | 'network': { |
| 110 | 'public_network_id': |
| 111 | '${_param:runtest_tempest_public_net}' |
| 112 | } |
| 113 | }, |
Oleksii Butenko | 173e770 | 2018-10-24 18:31:12 +0300 | [diff] [blame] | 114 | 'heat_plugin': { |
| 115 | 'build_timeout': '600' |
| 116 | }, |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 117 | 'share': { |
| 118 | 'capability_snapshot_support': True, |
| 119 | 'run_driver_assisted_migration_tests': False, |
| 120 | 'run_manage_unmanage_snapshot_tests': False, |
| 121 | 'run_manage_unmanage_tests': False, |
| 122 | 'run_migration_with_preserve_snapshots_tests': |
| 123 | False, |
| 124 | 'run_quota_tests': True, |
| 125 | 'run_replication_tests': False, |
| 126 | 'run_snapshot_tests': True, |
| 127 | }}}}} |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 128 | |
Oleksii Butenko | 71d76f3 | 2018-06-05 17:46:34 +0300 | [diff] [blame] | 129 | def fetch_arficats(self, username=None, file_format='xml'): |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 130 | with self.underlay.remote(node_name=self.target_name, |
| 131 | username=None) as tgt: |
Oleksii Butenko | 71d76f3 | 2018-06-05 17:46:34 +0300 | [diff] [blame] | 132 | result = tgt.execute('find {} -name "report_*.{}"'.format( |
| 133 | TEMPEST_CFG_DIR, file_format)) |
| 134 | LOG.debug("Find result {0}".format(result)) |
| 135 | assert len(result['stdout']) > 0, ('No report found, please check' |
| 136 | ' if test run was successful.') |
| 137 | report = result['stdout'][0].rstrip() |
| 138 | LOG.debug("Found files {0}".format(report)) |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 139 | tgt.download( |
Oleksii Butenko | 71d76f3 | 2018-06-05 17:46:34 +0300 | [diff] [blame] | 140 | destination=report, # noqa |
| 141 | target=os.getcwd()) |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 142 | |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 143 | def store_runtest_model(self, runtest_pillar=None): |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 144 | with self.underlay.yaml_editor( |
| 145 | file_path="/srv/salt/reclass/classes/cluster/" |
| 146 | "{cluster_name}/infra/" |
| 147 | "{class_name}.yml".format( |
| 148 | cluster_name=self.cluster_name, |
| 149 | class_name=self.class_name), |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 150 | node_name=self.master_name) as editor: |
| 151 | editor.content = runtest_pillar or self.runtest_pillar |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 152 | with self.underlay.yaml_editor( |
| 153 | file_path="/srv/salt/reclass/nodes/_generated/" |
| 154 | "cfg01.{domain_name}.yml".format( |
| 155 | domain_name=self.domain_name), |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 156 | node_name=self.master_name) as editor: |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 157 | editor.content['classes'].append( |
| 158 | 'cluster.{cluster_name}.infra.{class_name}'.format( |
| 159 | cluster_name=self.cluster_name, |
| 160 | class_name=self.class_name)) |
| 161 | |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 162 | def save_runtime_logs(self, logs=None, inspect=None): |
| 163 | if logs: |
| 164 | with open("{path}/{target}_tempest_run.log".format( |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 165 | path=settings.LOGS_DIR, |
| 166 | target=self.target_name), 'w') as f: |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 167 | LOG.info("Save tempest console log") |
| 168 | container_log = logs |
Oleksii Butenko | 71d76f3 | 2018-06-05 17:46:34 +0300 | [diff] [blame] | 169 | f.write(container_log.encode('ascii', 'ignore')) |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 170 | |
| 171 | if inspect: |
Oleksii Butenko | 71d76f3 | 2018-06-05 17:46:34 +0300 | [diff] [blame] | 172 | with open("{path}/{target}_tempest_container_info.json.log".format( |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 173 | path=settings.LOGS_DIR, |
| 174 | target=self.target_name), 'w') as f: |
Oleksii Butenko | 71d76f3 | 2018-06-05 17:46:34 +0300 | [diff] [blame] | 175 | LOG.info("Save tempest container inspect data") |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 176 | |
| 177 | container_inspect = json.dumps(inspect, |
| 178 | indent=4, sort_keys=True) |
| 179 | f.write(container_inspect) |
| 180 | |
Tatyana Leontovich | 61a821d | 2018-08-21 12:30:51 +0300 | [diff] [blame] | 181 | def prepare(self, dpdk=None): |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 182 | self.store_runtest_model() |
Oleksii Butenko | 09cc0cd | 2018-10-16 14:31:57 +0300 | [diff] [blame] | 183 | cirros_pillar = ("salt-call --out=newline_values_only " |
| 184 | "pillar.get " |
| 185 | "glance:client:identity:" |
| 186 | "admin_identity:image:cirros:location") |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 187 | salt_cmd = "salt -l info --hard-crash --state-output=mixed " |
| 188 | salt_call_cmd = "salt-call -l info --hard-crash --state-output=mixed " |
| 189 | commands = [ |
| 190 | { |
| 191 | 'description': "Sync salt objects for runtest model", |
| 192 | 'node_name': self.master_name, |
| 193 | 'cmd': ("set -ex;" + |
| 194 | salt_cmd + "'*' saltutil.refresh_pillar && " + |
| 195 | salt_cmd + "'*' saltutil.sync_all")}, |
| 196 | { |
| 197 | 'description': ("Install docker.io package and " |
| 198 | "enable packets forwarding"), |
| 199 | 'node_name': self.target_name, |
| 200 | 'cmd': ("set -ex;" + |
| 201 | salt_call_cmd + " pkg.install docker.io && " + |
| 202 | " iptables --policy FORWARD ACCEPT")}, |
| 203 | { |
| 204 | 'description': "Install PyPI docker package", |
| 205 | 'node_name': self.target_name, |
| 206 | 'cmd': ("set -ex;" + |
| 207 | salt_call_cmd + " pip.install setuptools && " + |
| 208 | salt_call_cmd + " pip.install docker")}, |
| 209 | { |
| 210 | 'description': "Run salt.minion state for runtest formula", |
| 211 | 'node_name': self.master_name, |
| 212 | 'cmd': ("set -ex;" + |
| 213 | salt_call_cmd + " state.sls salt.minion && " |
| 214 | " sleep 20")}, |
| 215 | { |
| 216 | 'description': "Enforce keystone state for neutronv2", |
| 217 | 'node_name': self.master_name, |
| 218 | 'cmd': ("set -ex;" + |
| 219 | salt_call_cmd + " state.sls keystone.client")}, |
| 220 | { |
| 221 | 'description': "Create networks for Tempest tests", |
| 222 | 'node_name': self.master_name, |
| 223 | 'cmd': ("set -ex;" + |
| 224 | salt_call_cmd + " state.sls neutron.client")}, |
| 225 | { |
| 226 | 'description': "Create flavors for Tempest tests", |
| 227 | 'node_name': self.master_name, |
| 228 | 'cmd': ("set -ex;" + |
| 229 | salt_call_cmd + " state.sls nova.client")}, |
| 230 | { |
Oleksii Butenko | 09cc0cd | 2018-10-16 14:31:57 +0300 | [diff] [blame] | 231 | 'description': "Upload images for Tempest", |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 232 | 'node_name': self.master_name, |
| 233 | 'cmd': ("set -ex;" + |
| 234 | salt_call_cmd + " state.sls glance.client")}, |
| 235 | { |
| 236 | 'description': "Generate config for Tempest", |
| 237 | 'node_name': self.master_name, |
| 238 | 'cmd': ("set -ex;" + |
| 239 | salt_call_cmd + " state.sls runtest")}, |
Oleksii Butenko | 09cc0cd | 2018-10-16 14:31:57 +0300 | [diff] [blame] | 240 | { |
| 241 | 'description': "Upload cirros image", |
| 242 | 'node_name': self.master_name, |
| 243 | 'cmd': ("set -ex;" |
| 244 | "cirros_url=$({}) && {} '{}' cmd.run " |
| 245 | "\"wget $cirros_url -O /tmp/TestCirros-0.3.5.img\"" |
| 246 | .format(cirros_pillar, salt_cmd, self.target_name))}, |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 247 | ] |
Oleksii Butenko | 5cd0a16 | 2018-06-14 18:18:10 +0300 | [diff] [blame] | 248 | |
Tatyana Leontovich | 61a821d | 2018-08-21 12:30:51 +0300 | [diff] [blame] | 249 | if dpdk: |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 250 | commands.append({ |
| 251 | 'description': "Configure flavor for DPDK", |
| 252 | 'node_name': self.control_name, |
| 253 | 'cmd': ("set -ex;" + |
| 254 | salt_call_cmd + " cmd.run " |
| 255 | " '. /root/keystonercv3;" |
sgudz | 905ec69 | 2018-10-16 15:30:39 +0300 | [diff] [blame] | 256 | " openstack flavor set m1.extra_tiny_test" |
| 257 | " --property hw:mem_page_size=any;" |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 258 | " openstack flavor set m1.tiny_test" |
sgudz | 905ec69 | 2018-10-16 15:30:39 +0300 | [diff] [blame] | 259 | " --property hw:mem_page_size=any'")}, |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 260 | ) |
Oleksii Butenko | 5cd0a16 | 2018-06-14 18:18:10 +0300 | [diff] [blame] | 261 | |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 262 | self.__salt_api.execute_commands(commands=commands, |
| 263 | label="Prepare for Tempest") |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 264 | |
| 265 | def run_tempest(self, timeout=600): |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 266 | tgt = self.target_name |
| 267 | image_nameversion = "{}:{}".format(self.image_name, self.image_version) |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 268 | |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 269 | docker_args = ( |
Oleksii Butenko | b0ca4cc | 2018-10-22 16:29:54 +0300 | [diff] [blame] | 270 | " -t " |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 271 | " --name {container_name} " |
| 272 | " -e ARGS=\"-r {tempest_pattern} -w {tempest_threads}\"" |
| 273 | " -v {cfg_dir}/tempest.conf:/etc/tempest/tempest.conf" |
| 274 | " -v /tmp/:/tmp/" |
| 275 | " -v {cfg_dir}:/root/tempest" |
| 276 | " -v /etc/ssl/certs/:/etc/ssl/certs/" |
Oleksii Butenko | b0ca4cc | 2018-10-22 16:29:54 +0300 | [diff] [blame] | 277 | " -d " |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 278 | " {image_nameversion} {run_cmd}" |
| 279 | .format( |
| 280 | container_name=self.container_name, |
| 281 | image_nameversion=image_nameversion, |
| 282 | tempest_pattern=self.tempest_pattern, |
| 283 | tempest_threads=self.tempest_threads, |
| 284 | cfg_dir=TEMPEST_CFG_DIR, |
| 285 | run_cmd=self.run_cmd, |
| 286 | )) |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 287 | |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 288 | commands = [ |
| 289 | { |
| 290 | 'description': "Run Tempest tests {0}".format( |
| 291 | image_nameversion), |
| 292 | 'node_name': self.target_name, |
| 293 | 'cmd': ("set -ex;" + |
| 294 | " docker rm --force {container_name} || true;" |
| 295 | " docker run {docker_args}" |
| 296 | .format(container_name=self.container_name, |
| 297 | docker_args=docker_args)), |
| 298 | 'timeout': timeout}, |
| 299 | ] |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 300 | |
Dennis Dmitriev | b6bcc5c | 2018-09-26 11:07:53 +0000 | [diff] [blame] | 301 | self.__salt_api.execute_commands(commands=commands, |
| 302 | label="Run Tempest tests") |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 303 | |
Oleksii Butenko | b0ca4cc | 2018-10-22 16:29:54 +0300 | [diff] [blame] | 304 | def wait_status(s): |
| 305 | inspect_res = self.salt_api.local(tgt, |
| 306 | 'dockerng.inspect', |
| 307 | self.container_name) |
| 308 | if 'return' in inspect_res: |
| 309 | inspect = inspect_res['return'] |
| 310 | inspect = inspect[0] |
| 311 | inspect = next(inspect.iteritems())[1] |
| 312 | status = inspect['State']['Status'] |
| 313 | |
| 314 | return status.lower() == s.lower() |
| 315 | |
| 316 | return False |
| 317 | |
| 318 | helpers.wait(lambda: wait_status('exited'), |
| 319 | timeout=timeout, |
| 320 | timeout_msg=('Tempest run didnt finished ' |
| 321 | 'in {}'.format(timeout))) |
| 322 | |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 323 | inspect_res = self.salt_api.local(tgt, |
| 324 | 'dockerng.inspect', |
| 325 | self.container_name) |
| 326 | inspect = inspect_res['return'][0] |
| 327 | inspect = next(inspect.iteritems())[1] |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 328 | logs_res = self.salt_api.local(tgt, |
| 329 | 'dockerng.logs', |
| 330 | self.container_name) |
| 331 | logs = logs_res['return'][0] |
| 332 | logs = next(logs.iteritems())[1] |
Dmitry Tyzhnenko | c56b77e | 2018-05-21 11:01:43 +0300 | [diff] [blame] | 333 | |
| 334 | res = self.salt_api.local(tgt, 'dockerng.rm', self.container_name) |
| 335 | LOG.info("Tempest container was removed".format( |
| 336 | json.dumps(res, indent=4))) |
| 337 | |
| 338 | return {'inspect': inspect, |
| 339 | 'logs': logs} |
Oleksii Butenko | e82441d | 2018-06-12 16:01:33 +0300 | [diff] [blame] | 340 | |
Tatyana Leontovich | 61a821d | 2018-08-21 12:30:51 +0300 | [diff] [blame] | 341 | def prepare_and_run_tempest(self, username='root', dpdk=None): |
Oleksii Butenko | e82441d | 2018-06-12 16:01:33 +0300 | [diff] [blame] | 342 | """ |
| 343 | Run tempest tests |
| 344 | """ |
| 345 | tempest_timeout = settings.TEMPEST_TIMEOUT |
Tatyana Leontovich | 61a821d | 2018-08-21 12:30:51 +0300 | [diff] [blame] | 346 | self.prepare(dpdk=dpdk) |
Oleksii Butenko | e82441d | 2018-06-12 16:01:33 +0300 | [diff] [blame] | 347 | test_res = self.run_tempest(tempest_timeout) |
| 348 | self.fetch_arficats(username=username) |
| 349 | self.save_runtime_logs(**test_res) |