sgudz | f0ff030 | 2018-01-29 18:50:01 +0200 | [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 | from tcp_tests.managers.jenkins.client import JenkinsClient |
| 17 | |
| 18 | from tcp_tests import logger |
| 19 | |
| 20 | LOG = logger.logger |
| 21 | |
| 22 | |
| 23 | @pytest.mark.deploy |
| 24 | class TestPipeline(object): |
| 25 | """Test class for testing deploy via Pipelines""" |
| 26 | |
| 27 | @pytest.mark.fail_snapshot |
| 28 | def test_pipeline(self, show_step, underlay, |
| 29 | common_services_deployed, salt_deployed): |
| 30 | """Runner for Juniper contrail-tests |
| 31 | |
| 32 | Scenario: |
| 33 | 1. Prepare salt on hosts. |
| 34 | 2. Setup controller nodes |
| 35 | 3. Setup compute nodes |
| 36 | 4. Deploy openstack via pipelines |
| 37 | 5. Deploy CICD via pipelines |
| 38 | """ |
| 39 | nodes = underlay.node_names() |
| 40 | LOG.info("Nodes - {}".format(nodes)) |
| 41 | cfg_node = 'cfg01.ocata-cicd.local' |
| 42 | salt_api = salt_deployed.get_pillar( |
| 43 | cfg_node, '_param:jenkins_salt_api_url') |
| 44 | salt_api = salt_api[0].get(cfg_node) |
| 45 | jenkins = JenkinsClient( |
| 46 | host='http://172.16.49.66:8081', |
| 47 | username='admin', |
| 48 | password='r00tme') |
| 49 | |
| 50 | # Creating param list for openstack deploy |
| 51 | params = jenkins.make_defults_params('deploy_openstack') |
| 52 | params['SALT_MASTER_URL'] = salt_api |
| 53 | params['STACK_INSTALL'] = 'core,kvm,openstack,ovs' |
| 54 | show_step(4) |
| 55 | build = jenkins.run_build('deploy_openstack', params) |
| 56 | jenkins.wait_end_of_build( |
| 57 | name=build[0], |
| 58 | build_id=build[1], |
| 59 | timeout=60 * 60 * 4) |
| 60 | result = jenkins.build_info(name=build[0], |
| 61 | build_id=build[1])['result'] |
| 62 | assert result == 'SUCCESS', "Deploy openstack was failed" |
| 63 | |
| 64 | # Changing param for cicd deploy |
| 65 | show_step(5) |
| 66 | params['STACK_INSTALL'] = 'cicd' |
| 67 | build = jenkins.run_build('deploy_openstack', params) |
| 68 | jenkins.wait_end_of_build( |
| 69 | name=build[0], |
| 70 | build_id=build[1], |
| 71 | timeout=60 * 60 * 2) |
| 72 | result = jenkins.build_info(name=build[0], |
| 73 | build_id=build[1])['result'] |
| 74 | assert result == 'SUCCESS', "Deploy CICD was failed" |
| 75 | |
| 76 | LOG.info("*************** DONE **************") |