Files
tempest/tempest/api/compute/admin/test_servers_on_multinodes.py
Jordan Pittier 8160d31e58 test.py: stop using aliases for creds manager
It could be confusing to new comers that the variables
cls.os and cls.os_primary or cls.alt_manager and cls.os_alt
actually are aliases. Besides we are not consistent in their usage.

This patch normalizes the usage around os_admin, os_primary and
os_alt. We keep the old aliases for compatibility but we should not
use them anymore.

This fix a long standing TODO item.

Change-Id: I5f7164f7a7ec5d4380ca22885000caa0183a0bf7
2017-04-26 10:34:56 +02:00

81 lines
3.2 KiB
Python

# Copyright 2016 NEC Corporation. All rights reserved.
#
# 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.
import testtools
from tempest.api.compute import base
from tempest import config
from tempest.lib import decorators
from tempest import test
CONF = config.CONF
class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
@classmethod
def skip_checks(cls):
super(ServersOnMultiNodesTest, cls).skip_checks()
if CONF.compute.min_compute_nodes < 2:
raise cls.skipException(
"Less than 2 compute nodes, skipping multi-nodes test.")
def _get_host(self, server_id):
return self.os_admin.servers_client.show_server(
server_id)['server']['OS-EXT-SRV-ATTR:host']
@decorators.idempotent_id('26a9d5df-6890-45f2-abc4-a659290cb130')
@testtools.skipUnless(
test.is_scheduler_filter_enabled("SameHostFilter"),
'SameHostFilter is not available.')
def test_create_servers_on_same_host(self):
server01 = self.create_test_server(wait_until='ACTIVE')['id']
hints = {'same_host': server01}
server02 = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')['id']
host01 = self._get_host(server01)
host02 = self._get_host(server02)
self.assertEqual(host01, host02)
@decorators.idempotent_id('cc7ca884-6e3e-42a3-a92f-c522fcf25e8e')
@testtools.skipUnless(
test.is_scheduler_filter_enabled("DifferentHostFilter"),
'DifferentHostFilter is not available.')
def test_create_servers_on_different_hosts(self):
server01 = self.create_test_server(wait_until='ACTIVE')['id']
hints = {'different_host': server01}
server02 = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')['id']
host01 = self._get_host(server01)
host02 = self._get_host(server02)
self.assertNotEqual(host01, host02)
@decorators.idempotent_id('7869cc84-d661-4e14-9f00-c18cdc89cf57')
@testtools.skipUnless(
test.is_scheduler_filter_enabled("DifferentHostFilter"),
'DifferentHostFilter is not available.')
def test_create_servers_on_different_hosts_with_list_of_servers(self):
server01 = self.create_test_server(wait_until='ACTIVE')['id']
# This scheduler-hint supports list of servers also.
hints = {'different_host': [server01]}
server02 = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')['id']
host01 = self._get_host(server01)
host02 = self._get_host(server02)
self.assertNotEqual(host01, host02)