Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +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 | import copy |
Dennis Dmitriev | a982b2d | 2016-10-21 16:52:50 +0300 | [diff] [blame] | 15 | import time |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 16 | |
| 17 | import pytest |
| 18 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 19 | from tcp_tests import settings |
| 20 | from tcp_tests.helpers import ext |
Dennis Dmitriev | 474e3f7 | 2016-10-21 16:46:09 +0300 | [diff] [blame] | 21 | from tcp_tests import logger |
| 22 | |
| 23 | LOG = logger.logger |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 24 | |
| 25 | |
| 26 | @pytest.mark.deploy |
| 27 | class TestTCPInstaller(object): |
| 28 | """Test class for testing TCP deployment""" |
| 29 | |
Dennis Dmitriev | 4be178c | 2016-10-25 13:17:46 +0300 | [diff] [blame] | 30 | #salt_cmd = 'salt -l debug ' # For debug output |
| 31 | #salt_call_cmd = 'salt-call -l debug ' # For debug output |
Dennis Dmitriev | 23e5d19 | 2016-10-31 11:27:10 +0200 | [diff] [blame] | 32 | salt_cmd = 'salt --hard-crash --state-output=mixed --state-verbose=False ' # For cause only output |
| 33 | salt_call_cmd = 'salt-call --hard-crash --state-output=mixed --state-verbose=False ' # For cause only output |
Dennis Dmitriev | 4be178c | 2016-10-25 13:17:46 +0300 | [diff] [blame] | 34 | #salt_cmd = 'salt --state-output=terse --state-verbose=False ' # For reduced output |
| 35 | #salt_call_cmd = 'salt-call --state-output=terse --state-verbose=False ' # For reduced output |
Dennis Dmitriev | 474e3f7 | 2016-10-21 16:46:09 +0300 | [diff] [blame] | 36 | |
Dennis Dmitriev | 474e3f7 | 2016-10-21 16:46:09 +0300 | [diff] [blame] | 37 | # @pytest.mark.snapshot_needed |
| 38 | # @pytest.mark.fail_snapshot |
Dennis Dmitriev | 9cc4ca3 | 2016-11-03 13:50:45 +0200 | [diff] [blame] | 39 | def test_tcp_install_default(self, underlay, openstack_deployed, |
| 40 | show_step, rally): |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 41 | """Test for deploying an tcp environment and check it |
| 42 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 43 | Scenario: |
Dennis Dmitriev | 4be178c | 2016-10-25 13:17:46 +0300 | [diff] [blame] | 44 | 1. Prepare salt on hosts |
| 45 | 2. Setup controller nodes |
| 46 | 3. Setup compute nodes |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 47 | |
Dennis Dmitriev | 75fce1b | 2016-10-18 15:04:28 +0300 | [diff] [blame] | 48 | """ |
dis | 58f2588 | 2016-12-06 19:13:15 +0200 | [diff] [blame^] | 49 | LOG.info("*************** DONE **************") |
| 50 | |
| 51 | def test_tcp_install_run_rally(self, underlay, openstack_deployed, |
| 52 | show_step, rally): |
| 53 | """Test for deploying an tcp environment and check it |
| 54 | |
| 55 | Scenario: |
| 56 | 1. Prepare salt on hosts |
| 57 | 2. Setup controller nodes |
| 58 | 3. Setup compute nodes |
| 59 | |
| 60 | """ |
Dennis Dmitriev | 9cc4ca3 | 2016-11-03 13:50:45 +0200 | [diff] [blame] | 61 | # prepare rally |
| 62 | rally.prepare() |
| 63 | rally.pull_image() |
| 64 | rally.run() |
| 65 | # run tempest |
| 66 | rally.run_tempest() |
| 67 | |
| 68 | res = rally.get_results() |
| 69 | |
| 70 | fail_msg = 'Tempest verification fails {}'.format(res) |
| 71 | assert res['failures'] == 0, fail_msg |
Dennis Dmitriev | 1a745e3 | 2016-11-07 14:40:28 +0200 | [diff] [blame] | 72 | |
Dennis Dmitriev | 1a745e3 | 2016-11-07 14:40:28 +0200 | [diff] [blame] | 73 | # @pytest.mark.snapshot_needed |
| 74 | # @pytest.mark.fail_snapshot |
| 75 | def test_tcp_install_with_scripts(self, config, underlay, salt_deployed, |
| 76 | show_step, rally): |
| 77 | """Test for deploying an tcp environment with scripts and check it |
| 78 | |
| 79 | Scenario: |
| 80 | 1. Prepare salt on hosts |
| 81 | 2. Setup controller nodes |
| 82 | 3. Setup compute nodes |
| 83 | |
| 84 | """ |
| 85 | |
| 86 | cmd = 'cd /srv/salt/reclass/scripts/; ./bootstrap_all.sh' |
| 87 | underlay.check_call(cmd, host=config.salt.salt_master_host, verbose=True) |
| 88 | |
| 89 | # prepare rally |
| 90 | rally.prepare() |
| 91 | rally.pull_image() |
| 92 | rally.run() |
| 93 | # run tempest |
| 94 | rally.run_tempest() |
| 95 | |
| 96 | res = rally.get_results() |
| 97 | |
| 98 | fail_msg = 'Tempest verification fails {}'.format(res) |
| 99 | assert res['failures'] == 0, fail_msg |