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

« back to all changes in this revision

Viewing changes to nova/tests/test_db_api.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2013-10-17 13:54:08 UTC
  • mfrom: (1.1.75)
  • Revision ID: package-import@ubuntu.com-20131017135408-n6jbddbictu9uazl
Tags: 1:2013.1.4-0ubuntu1
* Resynchronize with stable/grizzly (0409a09) (LP: #1241202):
  - [2ab1b6a] sql error when launching an instance from a volume LP: 1171190
  - [b5fa9f0] nova should check the is_public of flavor when creating an
    instance LP: 1212179
  - [f651317] nova boot --num-instances=50 times out  LP: 1199433
  - [ee9d1f6] Not prompt relevant message when stop a stoped vm LP: 1181934
  - [fc4d1f9] vmware driver should work without requiring patched wsdl
    LP: 1171215
  - [65b122f] launch index is not right if boot some VMs in one request
    LP: 1212648
  - [90fa239] VMware: Unable to spawn a instance when using Quantum and
    VMware drivers LP: 1202042
  - [474b8a4] Spawning multiple instances can cause race conditions with nbd
    LP: 1207422
  - [c704897]  Some sequence of characters in console-log can DoS nova-
    compute LP: 1215091
  - [43f2a4c] libvirt driver: Failed to attach new interface to VM
    LP: 1212565
  - [067fb93] Multi datastore support for provisioning of instances on ESX
    LP: 1104994
  - [fc9af8f] Compute nodes changing hostnames should log an error
    LP: 1224982
  - [cc1b72a] Security groups with source groups no longer work LP: 1216720
  - [faabb91] instance consoleauth  expired tokens need to be removed from
    the cache LP: 1209134
  - [5c55985] VHD snapshot from Hyper-V driver is bigger than original
    instance LP: 1177927
  - [d9ce5a4] normal user can show all the networks LP: 1186867
  - [6697489] hard reboot fails when using force_raw_images=False and
    use_cow_images=False and  LP: 1200249
  - [a59957c] Snapshot failure with VMwareVCDriver LP: 1184807
  - [542191d] VMWAREAPI: Problem with starting Windows instances on ESXi 5.1
    LP: 1187853
  - [62f2218] Exceptions during soft reboot should result in a hard reboot
    LP: 1202974
  - [f306875] Incorrect host stats reported by VMWare VCDriver LP: 1190515
  - [8e6b79f] Windows instances need timezone to be localtime LP: 1231254
  - [570e8c7] boto version breaks gating LP: 1237944
  - [6193176] hard reboot fails with preallocate_images=performance
    LP: 1200113
  - [a48f9df] mount_options: mount: /boot: No such file or directory
    LP: 1210371
  - [516ec3e] one port_id can add to two instance LP: 1204850
  - [f89e624] VMware: no VM connectivity when opaque network does not match
    bridge id LP: 1225002
  - [ba7ad53] Add boto special casing for param changes in 2.13
  - [7b2b673] Cannot live block migrate an instance without shared storage
    LP: 1193359
  - [0409a09] boto version checking in test cases is not backwards compatible
    LP: 1239220

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
"""Unit tests for the DB API."""
21
21
 
 
22
import copy
22
23
import datetime
23
24
import types
24
25
import uuid as stdlib_uuid
1813
1814
            self._assertEqualObjects(o1, objs2[o1['id']], ignored_keys)
1814
1815
 
1815
1816
 
 
1817
class NetworkTestCase(test.TestCase, ModelsObjectComparatorMixin):
 
1818
 
 
1819
    """Tests for db.api.network_* methods."""
 
1820
 
 
1821
    def setUp(self):
 
1822
        super(NetworkTestCase, self).setUp()
 
1823
        self.ctxt = context.get_admin_context()
 
1824
 
 
1825
    def test_network_get_all_admin_user(self):
 
1826
        networks = db.network_get_all(self.ctxt, project_only=True)
 
1827
        network1 = db.network_create_safe(self.ctxt, {})
 
1828
        networks.append(network1)
 
1829
        network2 = db.network_create_safe(self.ctxt,
 
1830
                                          {'project_id': 'project1'})
 
1831
        networks.append(network2)
 
1832
        self._assertEqualListsOfObjects(networks,
 
1833
                                        db.network_get_all(self.ctxt,
 
1834
                                                           project_only=True))
 
1835
 
 
1836
    def test_network_get_all_normal_user(self):
 
1837
        normal_ctxt = context.RequestContext('fake', 'fake')
 
1838
        db.network_create_safe(self.ctxt, {})
 
1839
        db.network_create_safe(self.ctxt, {'project_id': 'project1'})
 
1840
        network1 = db.network_create_safe(self.ctxt,
 
1841
                                          {'project_id': 'fake'})
 
1842
        network_db = db.network_get_all(normal_ctxt, project_only=True)
 
1843
        self.assertEqual(1, len(network_db))
 
1844
        self._assertEqualObjects(network1, network_db[0])
 
1845
 
 
1846
 
1816
1847
class ServiceTestCase(test.TestCase, ModelsObjectComparatorMixin):
1817
1848
    def setUp(self):
1818
1849
        super(ServiceTestCase, self).setUp()
2329
2360
            if bdm['device_name'] == values['device_name']:
2330
2361
                return bdm
2331
2362
 
 
2363
    def test_scrub_empty_str_values_no_effect(self):
 
2364
        values = {'volume_size': 5}
 
2365
        expected = copy.copy(values)
 
2366
        sqlalchemy_api._scrub_empty_str_values(values, ['volume_size'])
 
2367
        self.assertEqual(values, expected)
 
2368
 
 
2369
    def test_scrub_empty_str_values_empty_string(self):
 
2370
        values = {'volume_size': ''}
 
2371
        sqlalchemy_api._scrub_empty_str_values(values, ['volume_size'])
 
2372
        self.assertEqual(values, {})
 
2373
 
 
2374
    def test_scrub_empty_str_values_empty_unicode(self):
 
2375
        values = {'volume_size': u''}
 
2376
        sqlalchemy_api._scrub_empty_str_values(values, ['volume_size'])
 
2377
        self.assertEqual(values, {})
 
2378
 
2332
2379
    def test_block_device_mapping_create(self):
2333
2380
        bdm = self._create_bdm({})
2334
2381
        self.assertFalse(bdm is None)