Dennis Dmitriev | ee5ef23 | 2018-08-31 13:53:18 +0300 | [diff] [blame^] | 1 | # Copyright 2016 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 | |
| 15 | import pytest |
| 16 | |
| 17 | from tcp_tests import logger |
| 18 | from tcp_tests import settings |
| 19 | |
| 20 | LOG = logger.logger |
| 21 | |
| 22 | |
| 23 | class Test3rdpartySuites(object): |
| 24 | """Test class for running 3rdparty test suites |
| 25 | |
| 26 | Requires environment variables: |
| 27 | ENV_NAME |
| 28 | LAB_CONFIG_NAME |
| 29 | TESTS_CONFIGS |
| 30 | """ |
| 31 | |
| 32 | @pytest.mark.grab_versions |
| 33 | @pytest.mark.parametrize("_", [settings.ENV_NAME]) |
| 34 | @pytest.mark.run_tempest |
| 35 | def test_run_tempest(self, tempest_actions, show_step, _): |
| 36 | """Runner for Juniper contrail-tests |
| 37 | |
| 38 | Scenario: |
| 39 | 1. Run tempest |
| 40 | """ |
| 41 | show_step(1) |
| 42 | tempest_actions.prepare_and_run_tempest() |
| 43 | |
| 44 | @pytest.mark.grab_versions |
| 45 | @pytest.mark.parametrize("_", [settings.ENV_NAME]) |
| 46 | @pytest.mark.run_stacklight |
| 47 | def test_run_stacklight(self, sl_actions, show_step, _): |
| 48 | """Runner for Stacklight tests |
| 49 | |
| 50 | Scenario: |
| 51 | 1. Run SL test |
| 52 | """ |
| 53 | |
| 54 | # Run SL component tetsts |
| 55 | show_step(1) |
| 56 | sl_actions.setup_sl_functional_tests( |
| 57 | 'cfg01', |
| 58 | ) |
| 59 | sl_actions.run_sl_functional_tests( |
| 60 | 'cfg01', |
| 61 | '/root/stacklight-pytest/stacklight_tests/', |
| 62 | 'tests/prometheus', |
| 63 | 'test_alerts.py', |
| 64 | junit_report_name='stacklight_report.xml') |
| 65 | # Download report |
| 66 | sl_actions.download_sl_test_report( |
| 67 | 'cfg01', |
| 68 | '/root/stacklight-pytest/stacklight_tests/' |
| 69 | 'stacklight_report.xml') |
| 70 | |
| 71 | @pytest.mark.grab_versions |
| 72 | @pytest.mark.extract(container_system='docker', extract_from='conformance', |
| 73 | files_to_extract=['report']) |
| 74 | @pytest.mark.merge_xunit(path='/root/report', |
| 75 | output='/root/conformance_result.xml') |
| 76 | @pytest.mark.grab_k8s_results(name=['k8s_conformance.log', |
| 77 | 'conformance_result.xml']) |
| 78 | @pytest.mark.parametrize("_", [settings.ENV_NAME]) |
| 79 | @pytest.mark.k8s_conformance |
| 80 | def test_run_k8s_conformance(self, show_step, config, k8s_actions, |
| 81 | k8s_logs, _): |
| 82 | """Test run of k8s conformance tests""" |
| 83 | k8s_actions.run_conformance() |
| 84 | |
| 85 | @pytest.mark.grab_versions |
| 86 | @pytest.mark.grab_k8s_results(name=['virtlet_conformance.log', |
| 87 | 'report.xml']) |
| 88 | @pytest.mark.parametrize("_", [settings.ENV_NAME]) |
| 89 | @pytest.mark.k8s_conformance_virtlet |
| 90 | def test_run_k8s_conformance_virtlet(self, show_step, config, k8s_actions, |
| 91 | k8s_logs, _): |
| 92 | """Test run of k8s virtlet conformance tests""" |
| 93 | k8s_actions.run_virtlet_conformance() |