Move test trigger from template to test
Change-Id: I292a19c5accb25ff6874d7b22af4759a579d4a74
Reviewed-on: https://review.gerrithub.io/377679
Reviewed-by: Tatyanka Leontovich <tleontovich@mirantis.com>
Tested-by: Tatyanka Leontovich <tleontovich@mirantis.com>
diff --git a/tcp_tests/managers/openstack_manager.py b/tcp_tests/managers/openstack_manager.py
index c67c3d5..5396cef 100644
--- a/tcp_tests/managers/openstack_manager.py
+++ b/tcp_tests/managers/openstack_manager.py
@@ -11,8 +11,12 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+import os
from tcp_tests.managers.execute_commands import ExecuteCommandsMixin
+from tcp_tests import logger
+
+LOG = logger.logger
class OpenstackManager(ExecuteCommandsMixin):
@@ -32,3 +36,46 @@
self.execute_commands(commands,
label='Install OpenStack services')
self.__config.openstack.openstack_installed = True
+
+ def run_tempest(
+ self,
+ image_name='rally-tempest:with_designate',
+ target='gtw01', pattern=None,
+ conf_name='lvm_mcp.conf',
+ registry='docker-sandbox.sandbox.mirantis.net/rally-tempest/'):
+ target_name = [node_name for node_name
+ in self.__underlay.node_names() if target in node_name]
+
+ if pattern:
+ cmd = ("docker run --rm --net=host "
+ "-e TEMPEST_CONF={0} "
+ "-e SKIP_LIST=mcp_skip.list "
+ "-e SOURCE_FILE=keystonercv3 "
+ "-e CUSTOM='--pattern {1}' "
+ "-v /root/:/home/rally {2}{3} "
+ "-v /etc/ssl/certs/:/etc/ssl/certs/ >> image.output".format(
+ conf_name, pattern, registry, image_name))
+ else:
+ cmd = ("docker run --rm --net=host "
+ "-e TEMPEST_CONF={0} "
+ "-e SKIP_LIST=mcp_skip.list "
+ "-e SOURCE_FILE=keystonercv3 "
+ "-v /root/:/home/rally {2}{3} "
+ "-v /etc/ssl/certs/:/etc/ssl/certs/ >> image.output".format(
+ conf_name, pattern, registry, image_name))
+ with self.__underlay.remote(node_name=target_name[0]) as node_remote:
+ result = node_remote.execute(cmd)
+ LOG.debug("Test execution result is {}".format(result))
+ return result
+
+ def download_tempest_report(self, file_fromat='xml', stored_node='gtw01'):
+ target_node_name = [node_name for node_name
+ in self.__underlay.node_names()
+ if stored_node in node_name]
+ with self.__underlay.remote(node_name=target_node_name[0]) as r:
+ result = r.execute('find /root -name "report_*.{}"'.format(
+ file_fromat))
+ LOG.debug("Find result {0}".format(result))
+ file_name = result['stdout'][0].rstrip()
+ LOG.debug("Founded files {0}".format(file_name))
+ r.download(destination=file_name, target=os.getcwd())