Sort columns in node detailed list alphabetically
Currently we insert new fields in semi-random place. This change sorts
the columns alphabetically and enforces this order via unit tests.
Also correct the case of the "Automated Clean" heading.
Follow-up to commit dfd341585b
.
Change-Id: Id9909a85a5b8b53751c6e1034b9e1c1b15af3f77
This commit is contained in:
parent
300a441594
commit
9325743c0d
|
@ -603,73 +603,68 @@ class TestBaremetalList(TestBaremetal):
|
|||
**kwargs
|
||||
)
|
||||
|
||||
collist = ('Automated clean', 'Chassis UUID', 'Created At',
|
||||
'Clean Step', 'Conductor Group', 'Console Enabled',
|
||||
'Deploy Step', 'Driver', 'Driver Info',
|
||||
'Driver Internal Info', 'Extra', 'Instance Info',
|
||||
'Instance UUID', 'Last Error', 'Maintenance',
|
||||
'Maintenance Reason', 'Fault', 'Power State', 'Properties',
|
||||
'Provisioning State', 'Provision Updated At',
|
||||
'Current RAID configuration', 'Reservation',
|
||||
'Resource Class', 'Target Power State',
|
||||
'Target Provision State', 'Target RAID configuration',
|
||||
'Traits', 'Updated At', 'Inspection Finished At',
|
||||
'Inspection Started At', 'UUID', 'Name',
|
||||
'BIOS Interface', 'Boot Interface',
|
||||
'Console Interface', 'Deploy Interface',
|
||||
'Inspect Interface', 'Management Interface',
|
||||
'Network Interface', 'Power Interface',
|
||||
'RAID Interface', 'Rescue Interface',
|
||||
'Storage Interface', 'Vendor Interface')
|
||||
self.assertEqual(collist, columns)
|
||||
datalist = ((
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
baremetal_fakes.baremetal_instance_uuid,
|
||||
'',
|
||||
baremetal_fakes.baremetal_maintenance,
|
||||
'',
|
||||
'',
|
||||
baremetal_fakes.baremetal_power_state,
|
||||
'',
|
||||
baremetal_fakes.baremetal_provision_state,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
baremetal_fakes.baremetal_uuid,
|
||||
baremetal_fakes.baremetal_name,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
), )
|
||||
self.assertEqual(datalist, tuple(data))
|
||||
# NOTE(dtantsur): please keep this list sorted for sanity reasons
|
||||
collist = [
|
||||
'Automated Clean',
|
||||
'BIOS Interface',
|
||||
'Boot Interface',
|
||||
'Chassis UUID',
|
||||
'Clean Step',
|
||||
'Conductor Group',
|
||||
'Console Enabled',
|
||||
'Console Interface',
|
||||
'Created At',
|
||||
'Current RAID configuration',
|
||||
'Deploy Interface',
|
||||
'Deploy Step',
|
||||
'Driver',
|
||||
'Driver Info',
|
||||
'Driver Internal Info',
|
||||
'Extra',
|
||||
'Fault',
|
||||
'Inspect Interface',
|
||||
'Inspection Finished At',
|
||||
'Inspection Started At',
|
||||
'Instance Info',
|
||||
'Instance UUID',
|
||||
'Last Error',
|
||||
'Maintenance',
|
||||
'Maintenance Reason',
|
||||
'Management Interface',
|
||||
'Name',
|
||||
'Network Interface',
|
||||
'Power Interface',
|
||||
'Power State',
|
||||
'Properties',
|
||||
'Provision Updated At',
|
||||
'Provisioning State',
|
||||
'RAID Interface',
|
||||
'Rescue Interface',
|
||||
'Reservation',
|
||||
'Resource Class',
|
||||
'Storage Interface',
|
||||
'Target Power State',
|
||||
'Target Provision State',
|
||||
'Target RAID configuration',
|
||||
'Traits',
|
||||
'UUID',
|
||||
'Updated At',
|
||||
'Vendor Interface'
|
||||
]
|
||||
# Enforce sorting
|
||||
collist.sort()
|
||||
self.assertEqual(tuple(collist), columns)
|
||||
|
||||
fake_values = {
|
||||
'Instance UUID': baremetal_fakes.baremetal_instance_uuid,
|
||||
'Maintenance': baremetal_fakes.baremetal_maintenance,
|
||||
'Name': baremetal_fakes.baremetal_name,
|
||||
'Power State': baremetal_fakes.baremetal_power_state,
|
||||
'Provisioning State': baremetal_fakes.baremetal_provision_state,
|
||||
'UUID': baremetal_fakes.baremetal_uuid,
|
||||
}
|
||||
values = tuple(fake_values.get(name, '') for name in collist)
|
||||
self.assertEqual((values,), tuple(data))
|
||||
|
||||
def _test_baremetal_list_maintenance(self, maint_option, maint_value):
|
||||
arglist = [
|
||||
|
|
|
@ -33,7 +33,7 @@ class Resource(object):
|
|||
FIELDS = {
|
||||
'address': 'Address',
|
||||
'async': 'Async',
|
||||
'automated_clean': 'Automated clean',
|
||||
'automated_clean': 'Automated Clean',
|
||||
'attach': 'Response is attachment',
|
||||
'bios_name': 'BIOS setting name',
|
||||
'bios_value': 'BIOS setting value',
|
||||
|
@ -199,51 +199,54 @@ CHASSIS_RESOURCE = Resource(
|
|||
])
|
||||
|
||||
# Nodes
|
||||
# NOTE(dtantsur): the sorting of the list must follow the sorting for the
|
||||
# corresponding headings, so some items (like raid_config) may seem out of
|
||||
# order here.
|
||||
NODE_DETAILED_RESOURCE = Resource(
|
||||
['automated_clean',
|
||||
'bios_interface',
|
||||
'boot_interface',
|
||||
'chassis_uuid',
|
||||
'created_at',
|
||||
'clean_step',
|
||||
'conductor_group',
|
||||
'console_enabled',
|
||||
'console_interface',
|
||||
'created_at',
|
||||
'raid_config',
|
||||
'deploy_interface',
|
||||
'deploy_step',
|
||||
'driver',
|
||||
'driver_info',
|
||||
'driver_internal_info',
|
||||
'extra',
|
||||
'fault',
|
||||
'inspect_interface',
|
||||
'inspection_finished_at',
|
||||
'inspection_started_at',
|
||||
'instance_info',
|
||||
'instance_uuid',
|
||||
'last_error',
|
||||
'maintenance',
|
||||
'maintenance_reason',
|
||||
'fault',
|
||||
'management_interface',
|
||||
'name',
|
||||
'network_interface',
|
||||
'power_interface',
|
||||
'power_state',
|
||||
'properties',
|
||||
'provision_state',
|
||||
'provision_updated_at',
|
||||
'raid_config',
|
||||
'provision_state',
|
||||
'raid_interface',
|
||||
'rescue_interface',
|
||||
'reservation',
|
||||
'resource_class',
|
||||
'storage_interface',
|
||||
'target_power_state',
|
||||
'target_provision_state',
|
||||
'target_raid_config',
|
||||
'traits',
|
||||
'updated_at',
|
||||
'inspection_finished_at',
|
||||
'inspection_started_at',
|
||||
'uuid',
|
||||
'name',
|
||||
'bios_interface',
|
||||
'boot_interface',
|
||||
'console_interface',
|
||||
'deploy_interface',
|
||||
'inspect_interface',
|
||||
'management_interface',
|
||||
'network_interface',
|
||||
'power_interface',
|
||||
'raid_interface',
|
||||
'rescue_interface',
|
||||
'storage_interface',
|
||||
'updated_at',
|
||||
'vendor_interface',
|
||||
],
|
||||
sort_excluded=[
|
||||
|
|
Loading…
Reference in New Issue