Merge "nova limits ERROR (Exception): Field names must be unique"

This commit is contained in:
Zuul 2018-02-05 16:47:51 +00:00 committed by Gerrit Code Review
commit 5eb380d4c7
2 changed files with 22 additions and 1 deletions

View File

@ -18,6 +18,7 @@
import argparse
import base64
import collections
import datetime
import os
@ -43,6 +44,11 @@ FAKE_UUID_1 = fakes.FAKE_IMAGE_UUID_1
FAKE_UUID_2 = fakes.FAKE_IMAGE_UUID_2
# Converting dictionary to object
TestAbsoluteLimits = collections.namedtuple("TestAbsoluteLimits",
["name", "value"])
class ShellFixture(fixtures.Fixture):
def setUp(self):
super(ShellFixture, self).setUp()
@ -2814,6 +2820,20 @@ class ShellTest(utils.TestCase):
self.assertIn('Verb', stdout)
self.assertIn('Name', stdout)
def test_print_absolute_limits(self):
# Note: This test is to validate that no exception is
# thrown if in case we pass multiple custom fields
limits = [TestAbsoluteLimits('maxTotalPrivateNetworks', 3),
TestAbsoluteLimits('totalPrivateNetworksUsed', 0),
# Above two fields are custom fields
TestAbsoluteLimits('maxImageMeta', 15),
TestAbsoluteLimits('totalCoresUsed', 10),
TestAbsoluteLimits('totalInstancesUsed', 5),
TestAbsoluteLimits('maxServerMeta', 10),
TestAbsoluteLimits('totalRAMUsed', 10240),
TestAbsoluteLimits('totalFloatingIpsUsed', 10)]
novaclient.v2.shell._print_absolute_limits(limits=limits)
def test_limits_2_57(self):
"""Tests the limits command at microversion 2.57 where personality
size limits should not be shown.

View File

@ -2853,7 +2853,8 @@ def _print_absolute_limits(limits):
used[name] = l.value
else:
other[name] = l.value
columns.append('Other')
if 'Other' not in columns:
columns.append('Other')
if name not in limit_names:
limit_names.append(name)