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 | """ |
Dennis Dmitriev | 7b9538f | 2017-05-15 17:01:34 +0300 | [diff] [blame] | 48 | |
Dennis Dmitriev | 8253581 | 2017-05-15 19:28:41 +0300 | [diff] [blame] | 49 | nodes = underlay.node_names() |
| 50 | host = underlay.host_by_node_name(nodes[0]) |
| 51 | cmd = ("md5sum /httpboot/xenial-server-cloudimg-amd64.qcow2 " |
| 52 | "| awk '{print $1}'") |
| 53 | res = underlay.check_call(cmd, host=host, verbose=True) |
Dennis Dmitriev | 7b9538f | 2017-05-15 17:01:34 +0300 | [diff] [blame] | 54 | |
Dennis Dmitriev | 8253581 | 2017-05-15 19:28:41 +0300 | [diff] [blame] | 55 | ironic_url = 'http://{0}:6385/'.format(host) |
| 56 | |
| 57 | LOG.info("Ironic standalone server installed, to use it:\n\n" |
| 58 | "export OS_AUTH_TOKEN=fake-token\n" |
| 59 | "export IRONIC_URL={0}\n" |
| 60 | "export CLOUDINIT_IMAGE_MD5={1}" |
| 61 | .format(ironic_url, ''.join(res['stdout']))) |