Add test so we remember why CUSTOM_ prefix added

While it is tempting as an ironic operator to have CUSTOM_FOO in
placement, nova flavors and ironic resource class attributes,
allow that makes for a more complicated mapping between ironic
resource classes and the resource classes in the general case,
and could cause confusion when there is a typo of CUSTOM vs CUSTM
that could get mapped very differently into placement.

Adding this test so it is clear this is a deliberate choice, and
git blame will find this git commit message.

Related-Bug: #1724524

Change-Id: Ie38baea53e41ca7ba8875fd113cd777810f17db7
This commit is contained in:
John Garbutt 2017-10-18 11:47:49 +01:00
parent e11a8687ae
commit f73d6eb1dc
1 changed files with 11 additions and 0 deletions

View File

@ -351,6 +351,17 @@ class TestResourceClass(TestString):
self.to_primitive_values = self.coerce_good_values[0:1] self.to_primitive_values = self.coerce_good_values[0:1]
self.from_primitive_values = self.coerce_good_values[0:1] self.from_primitive_values = self.coerce_good_values[0:1]
def test_normalize_name(self):
values = [
("foo", "CUSTOM_FOO"),
("VCPU", "CUSTOM_VCPU"),
("CUSTOM_BOB", "CUSTOM_CUSTOM_BOB"),
("CUSTM_BOB", "CUSTOM_CUSTM_BOB"),
]
for test_value, expected in values:
result = fields.ResourceClass.normalize_name(test_value)
self.assertEqual(expected, result)
class TestInteger(TestField): class TestInteger(TestField):
def setUp(self): def setUp(self):