~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to nova/tests/test_instance_types.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, James Page
  • Date: 2013-03-20 12:59:22 UTC
  • mfrom: (1.1.69)
  • Revision ID: package-import@ubuntu.com-20130320125922-ohvfav96lemn9wlz
Tags: 1:2013.1~rc1-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/patches/avoid_setuptools_git_dependency.patch: Refreshed.
* debian/control: Clean up dependencies:
  - Dropped python-gflags no longer needed.
  - Dropped python-daemon no longer needed.
  - Dropped python-glance no longer needed.
  - Dropped python-lockfile no longer needed.
  - Dropped python-simplejson no longer needed.
  - Dropped python-tempita no longer needed.
  - Dropped python-xattr no longer needed.
  - Add sqlite3 required for the testsuite.

[ James Page ]
* d/watch: Update uversionmangle to deal with upstream versioning
  changes, remove tarballs.openstack.org. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
        self.assertEqual(inst_type['swap'], 0)
123
123
        self.assertEqual(inst_type['rxtx_factor'], 1.0)
124
124
 
 
125
    def test_instance_type_create_with_empty_flavorid(self):
 
126
        # Ensure that auto-generated uuid is assigned.
 
127
        name = 'Empty String ID Flavor'
 
128
        flavorid = ''
 
129
        inst_type = instance_types.create(name, 256, 1, 120, 100, flavorid)
 
130
        self.assertEqual(len(inst_type['flavorid']), 36)
 
131
        self.assertEqual(inst_type['name'], name)
 
132
        self.assertEqual(inst_type['memory_mb'], 256)
 
133
        self.assertEqual(inst_type['vcpus'], 1)
 
134
        self.assertEqual(inst_type['root_gb'], 120)
 
135
        self.assertEqual(inst_type['ephemeral_gb'], 100)
 
136
        self.assertEqual(inst_type['swap'], 0)
 
137
        self.assertEqual(inst_type['rxtx_factor'], 1.0)
 
138
 
125
139
    def test_instance_type_create_with_custom_rxtx_factor(self):
126
140
        name = 'Custom RXTX Factor'
127
141
        inst_type = instance_types.create(name, 256, 1, 120, 100,
351
365
                "test1", read_deleted="no")
352
366
        self.assertEqual("instance_type1_redo", instance_type["name"])
353
367
 
354
 
    def test_will_list_deleted_type_for_active_instance(self):
355
 
        # Ensure deleted instance types with active instances can be read.
356
 
        ctxt = context.get_admin_context()
357
 
        inst_type = instance_types.create("test", 256, 1, 120, 100, "test1")
358
 
 
359
 
        instance_params = {"instance_type_id": inst_type["id"]}
360
 
        instance = db.instance_create(ctxt, instance_params)
361
 
 
362
 
        # NOTE(jk0): Delete the instance type and reload the instance from the
363
 
        # DB. The instance_type object will still be available to the active
364
 
        # instance, otherwise being None.
365
 
        instance_types.destroy(inst_type["name"])
366
 
        instance = db.instance_get_by_uuid(ctxt, instance["uuid"])
367
 
 
368
 
        self.assertRaises(exception.InstanceTypeNotFound,
369
 
                instance_types.get_instance_type, inst_type["name"])
370
 
        self.assertTrue(instance["instance_type"])
371
 
 
372
368
 
373
369
class InstanceTypeToolsTest(test.TestCase):
374
370
    def _dict_to_metadata(self, data):