Dennis Dmitriev | 7b9538f | 2017-05-15 17:01:34 +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 |
| 15 | import os |
| 16 | import time |
| 17 | |
| 18 | import pytest |
| 19 | |
| 20 | from tcp_tests import settings |
| 21 | from tcp_tests.helpers import ext |
| 22 | from tcp_tests import logger |
| 23 | |
| 24 | LOG = logger.logger |
| 25 | |
| 26 | |
| 27 | class TestIronicStandalone(object): |
| 28 | """Test class for testing TCP deployment""" |
| 29 | |
| 30 | @pytest.mark.fail_snapshot |
| 31 | def test_install_ironic_standalone(self, config, underlay): |
| 32 | """Install a VM with standalone ironic |
| 33 | |
| 34 | Before using, please set the correct roles and timeout: |
| 35 | |
Dennis Dmitriev | fa911f5 | 2017-05-15 17:42:22 +0300 | [diff] [blame^] | 36 | export ROLES='["ironic_master"]' |
Dennis Dmitriev | 7b9538f | 2017-05-15 17:01:34 +0300 | [diff] [blame] | 37 | export BOOTSTRAP_TIMEOUT=900 |
| 38 | |
| 39 | , and unset these variables after the bootstrap is completed. |
| 40 | |
| 41 | Scenario: |
| 42 | 1. Install Ironic service and helper services |
| 43 | 2. Build ironic agent image |
| 44 | 3. Download Ubuntu cloud image and calculate MD5 |
| 45 | 4. export environment variables to further use |
| 46 | |
| 47 | """ |
| 48 | cmd = "md5sum /httpboot/xenial-server-cloudimg-amd64.qcow2 | awk '{print $1}'" |
| 49 | res = underlay.check_call(cmd, host=config.salt.salt_master_host, verbose=True) |
| 50 | |
| 51 | ironic_url = 'http://{0}:6385/'.format(config.salt.salt_master_host) |
| 52 | os.environ['CLOUDINIT_IMAGE_MD5'] = res['stdout'] |
| 53 | os.environ['OS_AUTH_TOKEN'] = 'fake-token' |
| 54 | os.environ['IRONIC_URL'] = ironic_url |
| 55 | |
| 56 | LOG.info("Ironic standalone server installed, to use it:\n" |
| 57 | " export OS_AUTH_TOKEN=fake-token\n" |
| 58 | " export IRONIC_URL={0}\n" |
| 59 | " export CLOUDINIT_IMAGE_MD5={1}" |
| 60 | .format(ironic_url, res['stdout'])) |