WIP: Basic API tests for sharding
Validates: - Filtering by a single shard - Filtering by >1 shards - Filtering by sharded nodes - Filtering by unsharded nodes Change-Id: Id37e8d6db098bb8decae87b6184bab4482321316
This commit is contained in:
parent
53039461b0
commit
39dbe213ab
|
@ -0,0 +1,114 @@
|
|||
# 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 tempest import config
|
||||
from tempest.lib import decorators
|
||||
|
||||
from ironic_tempest_plugin.tests.api import base
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class TestAddShardsToNode(base.BaseBaremetalTest):
|
||||
"""Tests for baremetal shards."""
|
||||
|
||||
min_microversion = '1.82'
|
||||
|
||||
def setUp(self):
|
||||
super(TestAddShardsToNode, self).setUp()
|
||||
# set a minimum API version
|
||||
_, self.chassis = self.create_chassis()
|
||||
|
||||
@decorators.idempotent_id('6f1e241d-4386-4730-b9ff-28c6a3dcad31')
|
||||
def test_add_shard_to_node_at_create(self):
|
||||
shard = 'at-create'
|
||||
|
||||
_, body = self.create_node(self.chassis['uuid'], shard=shard)
|
||||
self.assertEqual(shard, body['shard'])
|
||||
|
||||
@decorators.idempotent_id('2eb91d29-e0a5-472b-aeb8-ef6d98eb0f3c')
|
||||
def test_add_shard_to_node_post_create(self):
|
||||
shard = 'post-create'
|
||||
|
||||
_, node = self.create_node(self.chassis['uuid'])
|
||||
_, before = self.client.show_node(node['uuid'])
|
||||
self.assertIsNone(before['shard'])
|
||||
|
||||
self.client.update_node(node['uuid'], {'shard': shard})
|
||||
|
||||
_, after = self.client.show_node(node['uuid'])
|
||||
self.assertEqual(shard, after['shard'])
|
||||
|
||||
|
||||
class TestNodeShardQueries(base.BaseBaremetalTest):
|
||||
"""Tests for baremetal shards."""
|
||||
|
||||
min_microversion = '1.82'
|
||||
|
||||
def setUp(self):
|
||||
super(TestNodeShardQueries, self).setUp()
|
||||
_, self.chassis = self.create_chassis()
|
||||
_, bad_node = self.create_node(self.chassis['uuid'], shard='bad')
|
||||
_, none_node = self.create_node(self.chassis['uuid'], shard=None) # explicitly none
|
||||
self.bad_node_id = bad_node['uuid']
|
||||
self.none_node_id = none_node['uuid']
|
||||
|
||||
def _setup_nodes(self, good_shard, num=2):
|
||||
good_node_ids = []
|
||||
for i in range(num):
|
||||
_, node = self.create_node(self.chassis['uuid'], shard=good_shard)
|
||||
good_node_ids.append(node['uuid'])
|
||||
|
||||
return good_node_ids
|
||||
|
||||
@decorators.idempotent_id('6f1e241d-4386-4730-b9ff-28c6a3dcad31')
|
||||
def test_only_show_requested_shard(self):
|
||||
"""Validate filtering nodes by shard."""
|
||||
shard = "oneshardtest"
|
||||
good_node_ids = self._setup_nodes(shard)
|
||||
|
||||
_, fetched_nodes = self.client.list_nodes(shard=shard)
|
||||
fetched_node_ids = [node['uuid'] for node in fetched_nodes]
|
||||
|
||||
self.assertItemsEqual(good_node_ids, fetched_node_ids)
|
||||
|
||||
@decorators.idempotent_id('6f1e241d-4386-4730-b9ff-28c6a3dcad31')
|
||||
def test_only_show_multiple_requested_shards(self):
|
||||
"""Validate filtering nodes by multiple shards."""
|
||||
shard = "multishardtest"
|
||||
second_shard = "multishardtest2"
|
||||
good_node_ids = self._setup_nodes(shard)
|
||||
_, second_shard_node = self.create_node(self.chassis['uuid'], shard=second_shard)
|
||||
good_node_ids.append(second_shard_node['uuid'])
|
||||
|
||||
_, fetched_nodes = self.client.list_nodes(shard=[shard, second_shard])
|
||||
fetched_node_ids = [node['uuid'] for node in fetched_nodes['nodes']]
|
||||
|
||||
self.assertItemsEqual(good_node_ids, fetched_node_ids)
|
||||
self.assertNotIn(self.bad_node_id, fetched_node_ids)
|
||||
self.assertNotIn(self.none_node_id, fetched_node_ids)
|
||||
|
||||
@decorators.idempotent_id('f7a2eeb7-d16e-480c-b698-3448491c73a1')
|
||||
def test_show_sharded_nodes(self):
|
||||
_, fetched_nodes = self.client.list_nodes(sharded=True)
|
||||
fetched_node_ids = [node['uuid'] for node in fetched_nodes['nodes']]
|
||||
|
||||
# NOTE(JayF): All other nodes under test are sharded
|
||||
self.assertNotIn(self.none_node['uuid'], fetched_node_ids)
|
||||
|
||||
@decorators.idempotent_id('f7a2eeb7-d16e-480c-b698-3448491c73a1')
|
||||
def test_show_unsharded_nodes(self):
|
||||
_, fetched_nodes = self.client.list_nodes(sharded=False)
|
||||
fetched_node_ids = [node['uuid'] for node in fetched_nodes['nodes']]
|
||||
|
||||
self.assertIn(self.none_node['uuid'], fetched_node_ids)
|
||||
self.assertNotIn(self.bad_node['uuid'], fetched_node_ids)
|
|
@ -6,66 +6,66 @@
|
|||
check:
|
||||
jobs:
|
||||
# NOTE(dtantsur): keep N-3 and older non-voting for these jobs.
|
||||
- ironic-standalone
|
||||
- ironic-standalone-2023.2
|
||||
- ironic-standalone-2023.1
|
||||
- ironic-standalone-zed:
|
||||
voting: false
|
||||
#- ironic-standalone
|
||||
#- ironic-standalone-2023.2
|
||||
#- ironic-standalone-2023.1
|
||||
#- ironic-standalone-zed:
|
||||
# voting: false
|
||||
- ironic-tempest-functional-python3
|
||||
- ironic-tempest-functional-python3-2023.2
|
||||
- ironic-tempest-functional-python3-2023.1
|
||||
- ironic-tempest-functional-python3-zed:
|
||||
voting: false
|
||||
- ironic-tempest-functional-rbac-scope-enforced
|
||||
- ironic-tempest-functional-rbac-scope-enforced-2023.2
|
||||
#- ironic-tempest-functional-python3-2023.2
|
||||
#- ironic-tempest-functional-python3-2023.1
|
||||
#- ironic-tempest-functional-python3-zed:
|
||||
# voting: false
|
||||
#- ironic-tempest-functional-rbac-scope-enforced
|
||||
#- ironic-tempest-functional-rbac-scope-enforced-2023.2
|
||||
# Enable these *once* we have the policy fix backported
|
||||
# for making own node changes.
|
||||
# - ironic-tempest-functional-rbac-scope-enforced-2023.1
|
||||
# - ironic-tempest-functional-rbac-scope-enforced-zed
|
||||
- ironic-inspector-tempest
|
||||
- ironic-inspector-tempest-2023.2
|
||||
- ironic-inspector-tempest-2023.1
|
||||
- ironic-inspector-tempest-zed:
|
||||
voting: false
|
||||
- ironic-standalone-anaconda
|
||||
- ironic-standalone-anaconda-2023.2
|
||||
- ironic-standalone-anaconda-2023.1
|
||||
- ironic-standalone-redfish
|
||||
- ironic-standalone-redfish-2023.2
|
||||
- ironic-standalone-redfish-2023.1
|
||||
- ironic-standalone-redfish-zed:
|
||||
voting: false
|
||||
#- ironic-inspector-tempest
|
||||
#- ironic-inspector-tempest-2023.2
|
||||
#- ironic-inspector-tempest-2023.1
|
||||
#- ironic-inspector-tempest-zed:
|
||||
# voting: false
|
||||
#- ironic-standalone-anaconda
|
||||
#- ironic-standalone-anaconda-2023.2
|
||||
#- ironic-standalone-anaconda-2023.1
|
||||
#- ironic-standalone-redfish
|
||||
#- ironic-standalone-redfish-2023.2
|
||||
#- ironic-standalone-redfish-2023.1
|
||||
#- ironic-standalone-redfish-zed:
|
||||
# voting: false
|
||||
# NOTE(dtantsur): these jobs cover rarely changed tests and are quite
|
||||
# unstable, so keep them non-voting.
|
||||
- ironic-tempest-ipa-wholedisk-direct-tinyipa-multinode:
|
||||
voting: false
|
||||
- ironic-tempest-ipa-wholedisk-direct-tinyipa-multinode-2023.2:
|
||||
voting: false
|
||||
- ironic-tempest-ipa-wholedisk-direct-tinyipa-multinode-2023.1:
|
||||
voting: false
|
||||
- ironic-tempest-ipa-wholedisk-direct-tinyipa-multinode-zed:
|
||||
voting: false
|
||||
- ironic-inspector-tempest-discovery
|
||||
- ironic-inspector-tempest-discovery-2023.2
|
||||
- ironic-inspector-tempest-discovery-2023.1
|
||||
- ironic-inspector-tempest-discovery-zed:
|
||||
voting: false
|
||||
#- ironic-tempest-ipa-wholedisk-direct-tinyipa-multinode:
|
||||
# voting: false
|
||||
#- ironic-tempest-ipa-wholedisk-direct-tinyipa-multinode-2023.2:
|
||||
# voting: false
|
||||
#- ironic-tempest-ipa-wholedisk-direct-tinyipa-multinode-2023.1:
|
||||
# voting: false
|
||||
#- ironic-tempest-ipa-wholedisk-direct-tinyipa-multinode-zed:
|
||||
# voting: false
|
||||
#- ironic-inspector-tempest-discovery
|
||||
#- ironic-inspector-tempest-discovery-2023.2
|
||||
#- ironic-inspector-tempest-discovery-2023.1
|
||||
#- ironic-inspector-tempest-discovery-zed:
|
||||
# voting: false
|
||||
gate:
|
||||
jobs:
|
||||
- ironic-standalone
|
||||
- ironic-standalone-2023.2
|
||||
- ironic-standalone-2023.1
|
||||
#- ironic-standalone
|
||||
#- ironic-standalone-2023.2
|
||||
#- ironic-standalone-2023.1
|
||||
- ironic-tempest-functional-python3
|
||||
- ironic-tempest-functional-python3-2023.2
|
||||
- ironic-tempest-functional-python3-2023.1
|
||||
- ironic-tempest-functional-rbac-scope-enforced-2023.2
|
||||
- ironic-tempest-functional-rbac-scope-enforced
|
||||
- ironic-inspector-tempest
|
||||
- ironic-inspector-tempest-2023.2
|
||||
- ironic-inspector-tempest-2023.1
|
||||
- ironic-inspector-tempest-rbac-scope-enforced
|
||||
- ironic-inspector-tempest-rbac-scope-enforced-2023.2
|
||||
- ironic-standalone-redfish
|
||||
- ironic-standalone-redfish-2023.2
|
||||
- ironic-standalone-redfish-2023.1
|
||||
- ironic-inspector-tempest-discovery
|
||||
#- ironic-tempest-functional-python3-2023.2
|
||||
#- ironic-tempest-functional-python3-2023.1
|
||||
#- ironic-tempest-functional-rbac-scope-enforced-2023.2
|
||||
#- ironic-tempest-functional-rbac-scope-enforced
|
||||
#- ironic-inspector-tempest
|
||||
#- ironic-inspector-tempest-2023.2
|
||||
#- ironic-inspector-tempest-2023.1
|
||||
#- ironic-inspector-tempest-rbac-scope-enforced
|
||||
#- ironic-inspector-tempest-rbac-scope-enforced-2023.2
|
||||
#- ironic-standalone-redfish
|
||||
#- ironic-standalone-redfish-2023.2
|
||||
#- ironic-standalone-redfish-2023.1
|
||||
#- ironic-inspector-tempest-discovery
|
||||
|
|
Loading…
Reference in New Issue