WIP: Basic tests for sharding

Change-Id: Id37e8d6db098bb8decae87b6184bab4482321316
This commit is contained in:
Jay Faulkner 2024-01-25 10:04:51 -08:00
parent 53039461b0
commit 14da20be77
1 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,53 @@
# 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 oslo_utils import uuidutils
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from ironic_tempest_plugin.common import waiters
from ironic_tempest_plugin.tests.api.admin import api_microversion_fixture
from ironic_tempest_plugin.tests.api import base
CONF = config.CONF
class TestAddShardsToNode(base.BaseBaremetalTest):
"""Tests for baremetal shards."""
def setUp(self):
super(TestAddShardsToNode, self).setUp()
_, 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(before['after'], shard)