diff options
author | Scott Moser <smoser@ubuntu.com> | 2013-09-27 12:26:25 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-09-27 12:26:25 -0400 |
commit | 55490f1f040f7e00985375872938c80e41803f4e (patch) | |
tree | 74e9a676d787761c9711205a1f4d0493bcf79e3c /tests/unittests/test_datasource/test_smartos.py | |
parent | 4d13fa79b32636bfab27540c76f46fcfb7ce7f5c (diff) | |
download | vyos-cloud-init-55490f1f040f7e00985375872938c80e41803f4e.tar.gz vyos-cloud-init-55490f1f040f7e00985375872938c80e41803f4e.zip |
fix tests small other changes
Also
* cloudinit/sources/DataSourceAzure.py: invalid xml in a file called
'ovfenv.xml' should raise BrokenAzureDatasource rather than
NonAzureDataSource
* cloudinit/sources/DataSourceSmartOS.py:
cloudinit/sources/DataSourceAzure.py
use 'ephemeral0' as the device name in builtin fs_setup
* tests/unittests/test_datasource/test_azure.py:
* always patch 'list_possible_azure_ds_devs' as it calls find_devs_with
which calls blkid, and dramatically was slowing down tests on my system.
* test_user_cfg_set_agent_command_plain:
fix this test to not depend on specific format of yaml.dumps().
* test_userdata_arrives: add a test that user-data makes it through
Diffstat (limited to 'tests/unittests/test_datasource/test_smartos.py')
-rw-r--r-- | tests/unittests/test_datasource/test_smartos.py | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/tests/unittests/test_datasource/test_smartos.py b/tests/unittests/test_datasource/test_smartos.py index 56fe811e..956767d8 100644 --- a/tests/unittests/test_datasource/test_smartos.py +++ b/tests/unittests/test_datasource/test_smartos.py @@ -79,7 +79,6 @@ class MockSerial(object): if self.last in self.mockdata: if not self.mocked_out: self.mocked_out = [x for x in self._format_out()] - print self.mocked_out if len(self.mocked_out) > self.count: self.count += 1 @@ -275,26 +274,25 @@ class TestSmartOSDataSource(MockerTestCase): self.assertIsInstance(cfg['disk_setup'], dict) self.assertIsInstance(cfg['fs_setup'], list) - def test_override_builtin_ds(self): + def test_override_disk_aliases(self): # Test to make sure that the built-in DS is overriden - data = {} - data['disk_setup'] = {'test_dev': {}} - data['fs_setup'] = [{'label': 'test_dev'}] - data['serial_device'] = '/dev/ttyS2' - dsrc = self._get_ds(ds_cfg=data) - cfg = dsrc.get_config_obj() + builtin = DataSourceSmartOS.BUILTIN_DS_CONFIG + + mydscfg = {'disk_aliases': {'FOO': '/dev/bar'}} + # expect that these values are in builtin, or this is pointless + for k in mydscfg: + self.assertIn(k, builtin) + + dsrc = self._get_ds(ds_cfg=mydscfg) ret = dsrc.get_data() self.assertTrue(ret) - assert 'disk_setup' in cfg - assert 'fs_setup' in cfg - self.assertIsInstance(cfg['disk_setup'], dict) - self.assertIsInstance(cfg['fs_setup'], list) - assert 'test_dev' in cfg['disk_setup'] - assert 'test_dev' in cfg['fs_setup'][0]['label'] + self.assertEqual(mydscfg['disk_aliases']['FOO'], + dsrc.ds_cfg['disk_aliases']['FOO']) - self.assertEquals(data['serial_device'], dsrc.seed) + self.assertEqual(dsrc.device_name_to_device('FOO'), + mydscfg['disk_aliases']['FOO']) def apply_patches(patches): |