add new test fixture flavor with extra_specs

We support flavor extra_specs, so it would probably make sense to
have some in one of the test fixture flavors.

In order to make it compatible with the functional tests we'll make
it as small as m1.tiny.
Change-Id: Ic98d7dd2f44796279e18083a8c423aed0066d177
This commit is contained in:
Chris Friesen 2017-06-01 19:29:52 -06:00
parent 539342216f
commit 31d2e465e3
7 changed files with 83 additions and 3 deletions

View File

@ -109,6 +109,28 @@
"swap": "",
"vcpus": 8,
"rxtx_factor": 1.0
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 0,
"os-flavor-access:is_public": true,
"id": "6",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/6",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/6",
"rel": "bookmark"
}
],
"name": "m1.tiny.specs",
"ram": 512,
"swap": "",
"vcpus": 1,
"rxtx_factor": 1.0
}
]
}

View File

@ -69,6 +69,20 @@
}
],
"name": "m1.xlarge"
},
{
"id": "6",
"links": [
{
"href": "http://openstack.example.com/v2/6f70656e737461636b20342065766572/flavors/6",
"rel": "self"
},
{
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/flavors/6",
"rel": "bookmark"
}
],
"name": "m1.tiny.specs"
}
]
}
}

View File

@ -622,6 +622,11 @@ class DefaultFlavorsFixture(fixtures.Fixture):
ctxt = context.get_admin_context()
defaults = {'rxtx_factor': 1.0, 'disabled': False, 'is_public': True,
'ephemeral_gb': 0, 'swap': 0}
extra_specs = {
"hw:cpu_model": "SandyBridge",
"hw:mem_page_size": "2048",
"hw:cpu_policy": "dedicated"
}
default_flavors = [
objects.Flavor(context=ctxt, memory_mb=512, vcpus=1,
root_gb=1, flavorid='1', name='m1.tiny',
@ -638,6 +643,9 @@ class DefaultFlavorsFixture(fixtures.Fixture):
objects.Flavor(context=ctxt, memory_mb=16384, vcpus=8,
root_gb=160, flavorid='5', name='m1.xlarge',
**defaults),
objects.Flavor(context=ctxt, memory_mb=512, vcpus=1,
root_gb=1, flavorid='6', name='m1.tiny.specs',
extra_specs=extra_specs, **defaults),
]
for flavor in default_flavors:
flavor.create()

View File

@ -109,6 +109,28 @@
"swap": "",
"vcpus": 8,
"rxtx_factor": 1.0
},
{
"OS-FLV-DISABLED:disabled": false,
"disk": 1,
"OS-FLV-EXT-DATA:ephemeral": 0,
"id": "6",
"links": [
{
"href": "%(versioned_compute_endpoint)s/flavors/6",
"rel": "self"
},
{
"href": "%(compute_endpoint)s/flavors/6",
"rel": "bookmark"
}
],
"name": "m1.tiny.specs",
"os-flavor-access:is_public": true,
"ram": 512,
"swap": "",
"vcpus": 1,
"rxtx_factor": 1.0
}
]
}

View File

@ -69,6 +69,20 @@
}
],
"name": "m1.xlarge"
},
{
"id": "6",
"links": [
{
"href": "%(versioned_compute_endpoint)s/flavors/6",
"rel": "self"
},
{
"href": "%(compute_endpoint)s/flavors/6",
"rel": "bookmark"
}
],
"name": "m1.tiny.specs"
}
]
}

View File

@ -333,7 +333,7 @@ class TestDefaultFlavorsFixture(testtools.TestCase):
result = conn.execute("select * from flavors")
rows = result.fetchall()
self.assertEqual(5, len(rows), "Rows %s" % rows)
self.assertEqual(6, len(rows), "Rows %s" % rows)
class TestIndirectionAPIFixture(testtools.TestCase):

View File

@ -154,7 +154,7 @@ class InstanceTypeFilteringTest(test.TestCase):
def test_no_filters(self):
filters = None
expected = ['m1.tiny', 'm1.small', 'm1.medium', 'm1.large',
'm1.xlarge']
'm1.xlarge', 'm1.tiny.specs']
self.assertFilterResults(filters, expected)
def test_min_memory_mb_filter(self):