fuel-qa/fuelweb_test/tests/test_vcenter.py

90 lines
3.3 KiB
Python

# Copyright 2014 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.helpers.decorators import log_snapshot_on_error
from fuelweb_test import logger
from fuelweb_test.settings import DEPLOYMENT_MODE
from fuelweb_test.settings import VCENTER_IP
from fuelweb_test.settings import VCENTER_USERNAME
from fuelweb_test.settings import VCENTER_PASSWORD
from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.tests.base_test_case import TestBasic
@test(groups=["vcenter"])
class VcenterDeploy(TestBasic):
@test(depends_on=[SetupEnvironment.prepare_slaves_1],
groups=["smoke", "vcenter_smoke"])
@log_snapshot_on_error
def vcenter_smoke(self):
"""Deploy dual hypervisors cluster with controller node only
Scenario:
1. Create cluster
2. Add 1 node with controller role
3. Deploy the cluster
4. Run OSTF
"""
self.env.revert_snapshot("ready_with_1_slaves")
# Configure cluster
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=DEPLOYMENT_MODE,
vcenter_value={
"glance": {
"vcenter_username": "",
"datacenter": "",
"vcenter_host": "",
"vcenter_password": "",
"datastore": "", },
"availability_zones": [
{"vcenter_username": VCENTER_USERNAME,
"nova_computes": [
{"datastore_regex": ".*",
"vsphere_cluster": "Cluster1",
"service_name": "vmclaster"
},
],
"vcenter_host": VCENTER_IP,
"cinder": {"enable": False},
"az_name": "vcenter",
"vcenter_password": VCENTER_PASSWORD,
}],
"network": {"esxi_vlan_interface": "vmnic0"}
}
)
logger.info("cluster is {}".format(cluster_id))
# Assign role to node
self.fuel_web.update_nodes(
cluster_id,
{'slave-01': ['controller'], }
)
self.fuel_web.deploy_cluster_wait(cluster_id)
# FIXME when OSTF test will be fixed in bug #1431758
# When the bug will be fixed 'should_fail=1' and
# 'failed_test_name' parameter should be removed.
self.fuel_web.run_ostf(
cluster_id=cluster_id, test_sets=['smoke', 'sanity', 'ha'],
should_fail=1,
failed_test_name=[('vCenter: Launch instance, create snapshot, '
'launch instance from snapshot')]
)