fuel-qa/gates_tests/tests/test_review_in_fuel_agent.py
Artem Panchenko c51c39282b Upload new packages before rebuilding bootstrap
Packages assembled from CR were uploaded after cluster
creation in step #9, so bootstrap image was built with
old package. Now test uploads fresh packages before
rebuilding bootstrap image.

Also moved the step with package version verification
before the step with cluster deployment and added
possibility to remove old packages from target
repository while uploading new files.

Change-Id: Id768b87980fa112c1dbb82f886f390798ce4d8b0
Closes-bug: #1574591
(cherry picked from commit 86dfc2d009)
2016-04-26 12:58:21 +00:00

150 lines
5.3 KiB
Python

# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from proboscis import test
from fuelweb_test import settings
from fuelweb_test.helpers.fuel_actions import BaseActions
from fuelweb_test.helpers import ironic_actions
from fuelweb_test.helpers.checkers import verify_bootstrap_on_node
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.tests.test_ironic_base import TestIronicDeploy
from gates_tests.helpers import exceptions
from gates_tests.helpers.utils import replace_rpm_package
from gates_tests.helpers.utils import \
check_package_version_injected_in_bootstraps
@test(groups=["review_fuel_agent"])
class Gate(TestIronicDeploy):
"""Using in fuel-agent CI-gates
Update fuel-agent on master node, bootstrap from review,
build environment images and provision one node"""
@staticmethod
def update_bootstrap_cli_yaml():
actions = BaseActions()
path = "/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml"
element = ['repos']
new_repo = {'name': 'auxiliary', 'priority': "1200",
'section': 'main restricted',
'suite': 'auxiliary', 'type': 'deb',
'uri': 'http://127.0.0.1:8080/ubuntu/auxiliary/'}
repos = actions.get_value_from_remote_yaml(path, element)
repos.append(new_repo)
actions.change_remote_yaml(path, element, repos)
@test(depends_on_groups=['prepare_release'],
groups=["review_fuel_agent_ironic_deploy"])
@log_snapshot_after_test
def gate_patch_fuel_agent(self):
""" Revert snapshot, update fuel-agent, bootstrap from review
and provision one node
Scenario:
1. Revert snapshot "ready"
2. Update fuel-agent, fuel-bootstrap-cli on master node
3. Update fuel_bootstrap_cli.yaml
4. Rebuild bootstrap
5. Verify fuel-agent version in ubuntu bootstrap image
6. Bootstrap 5 slaves
7. Verify Ubuntu bootstrap on slaves
8. Add 1 node with controller
9. Add 1 node ironic role
10. Deploy the cluster
11. Verify fuel-agent version in ironic-bootstrap
12. Upload image to glance
13. Enroll Ironic nodes
14. Boot nova instance
15. Check Nova instance status
Snapshot review_fuel_agent_ironic_deploy
"""
if not settings.UPDATE_FUEL:
raise exceptions.FuelQAVariableNotSet(settings.UPDATE_FUEL, 'true')
self.show_step(1, initialize=True)
self.env.revert_snapshot("ready")
self.show_step(2)
replace_rpm_package('fuel-agent')
replace_rpm_package('fuel-bootstrap-cli')
self.show_step(3)
self.update_bootstrap_cli_yaml()
self.show_step(4)
if settings.UPDATE_FUEL:
self.env.admin_actions.upload_packages(
local_packages_dir=settings.UPDATE_FUEL_PATH,
centos_repo_path=None,
ubuntu_repo_path=settings.LOCAL_MIRROR_UBUNTU,
clean_target=True)
uuid, bootstrap_location = \
self.env.fuel_bootstrap_actions.build_bootstrap_image()
self.env.fuel_bootstrap_actions. \
import_bootstrap_image(bootstrap_location)
self.env.fuel_bootstrap_actions. \
activate_bootstrap_image(uuid)
self.show_step(5)
check_package_version_injected_in_bootstraps("fuel-agent")
self.show_step(6)
self.env.bootstrap_nodes(
self.env.d_env.nodes().slaves[:2])
self.show_step(7)
for node in self.env.d_env.nodes().slaves[:2]:
_ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip']
verify_bootstrap_on_node(_ip, os_type="ubuntu", uuid=uuid)
data = {
"net_provider": 'neutron',
"net_segment_type": settings.NEUTRON_SEGMENT['vlan'],
"ironic": True}
nodes = {
'slave-01': ['controller'],
'slave-02': ['ironic']}
self.show_step(8)
self.show_step(9)
self.show_step(10)
cluster_id = self._deploy_ironic_cluster(settings=data, nodes=nodes)
ironic_conn = ironic_actions.IronicActions(
self.fuel_web.get_public_vip(cluster_id))
self.show_step(11)
check_package_version_injected_in_bootstraps("fuel-agent",
cluster_id=cluster_id,
ironic=True)
self.show_step(12)
self.show_step(13)
self._create_os_resources(ironic_conn)
self.show_step(14)
self._boot_nova_instances(ironic_conn)
self.show_step(15)
ironic_conn.wait_for_vms(ironic_conn)
ironic_conn.verify_vms_connection(ironic_conn)
self.env.make_snapshot("review_fuel_agent_ironic_deploy")