示例#1
0
    def test_mapping_prepend_dev(self):
        mappings = [
            {'virtual': 'ami',
             'device': 'sda1'},
            {'virtual': 'root',
             'device': '/dev/sda1'},

            {'virtual': 'swap',
             'device': 'sdb1'},
            {'virtual': 'swap',
             'device': '/dev/sdb2'},

            {'virtual': 'ephemeral0',
            'device': 'sdc1'},
            {'virtual': 'ephemeral1',
             'device': '/dev/sdc1'}]
        expected_result = [
            {'virtual': 'ami',
             'device': 'sda1'},
            {'virtual': 'root',
             'device': '/dev/sda1'},

            {'virtual': 'swap',
             'device': '/dev/sdb1'},
            {'virtual': 'swap',
             'device': '/dev/sdb2'},

            {'virtual': 'ephemeral0',
             'device': '/dev/sdc1'},
            {'virtual': 'ephemeral1',
             'device': '/dev/sdc1'}]
        self.assertThat(block_device.mappings_prepend_dev(mappings),
                        matchers.DictListMatches(expected_result))
示例#2
0
    def test_mappings_prepend_dev(self):
        mapping = [
            {'virtual': 'ami', 'device': '/dev/sda'},
            {'virtual': 'root', 'device': 'sda'},
            {'virtual': 'ephemeral0', 'device': 'sdb'},
            {'virtual': 'swap', 'device': 'sdc'},
            {'virtual': 'ephemeral1', 'device': 'sdd'},
            {'virtual': 'ephemeral2', 'device': 'sde'}]

        expected = [
            {'virtual': 'ami', 'device': '/dev/sda'},
            {'virtual': 'root', 'device': 'sda'},
            {'virtual': 'ephemeral0', 'device': '/dev/sdb'},
            {'virtual': 'swap', 'device': '/dev/sdc'},
            {'virtual': 'ephemeral1', 'device': '/dev/sdd'},
            {'virtual': 'ephemeral2', 'device': '/dev/sde'}]

        prepended = block_device.mappings_prepend_dev(mapping)
        self.assertEqual(prepended.sort(), expected.sort())
示例#3
0
 def test_mapping_prepend_dev(self):
     mappings = [{
         'virtual': 'ami',
         'device': 'sda1'
     }, {
         'virtual': 'root',
         'device': '/dev/sda1'
     }, {
         'virtual': 'swap',
         'device': 'sdb1'
     }, {
         'virtual': 'swap',
         'device': '/dev/sdb2'
     }, {
         'virtual': 'ephemeral0',
         'device': 'sdc1'
     }, {
         'virtual': 'ephemeral1',
         'device': '/dev/sdc1'
     }]
     expected_result = [{
         'virtual': 'ami',
         'device': 'sda1'
     }, {
         'virtual': 'root',
         'device': '/dev/sda1'
     }, {
         'virtual': 'swap',
         'device': '/dev/sdb1'
     }, {
         'virtual': 'swap',
         'device': '/dev/sdb2'
     }, {
         'virtual': 'ephemeral0',
         'device': '/dev/sdc1'
     }, {
         'virtual': 'ephemeral1',
         'device': '/dev/sdc1'
     }]
     self.assertThat(block_device.mappings_prepend_dev(mappings),
                     matchers.DictListMatches(expected_result))