summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource/test_smartos.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-09-27 19:38:05 -0400
committerScott Moser <smoser@ubuntu.com>2013-09-27 19:38:05 -0400
commitcafa32eb35e6ef7eba70a49e56dfeda51fd1f8a1 (patch)
tree25596b8dc52d4e355805dfdff2032763e57d73cc /tests/unittests/test_datasource/test_smartos.py
parent4063358ec2f20bcff4328fb659cecbed668a9a48 (diff)
parentfdf5a48420b670b4b07c745b2b80c1cb23f253db (diff)
downloadvyos-cloud-init-cafa32eb35e6ef7eba70a49e56dfeda51fd1f8a1.tar.gz
vyos-cloud-init-cafa32eb35e6ef7eba70a49e56dfeda51fd1f8a1.zip
Enable filesystem creation on Azure, many disk_setup cleanups
There are a lot of cleanups here around Azure, SmartOS and disk_setup. disk_setup correctly identifies disk "aliases" (block device mappings from ec2), anywhere where you would use a device name. You can also specify these mappings to the Azure or SmartOS datasource in their datasource config (device_aliases). Also, stop Azure from calling blkid repeatedly in its tests, which really pounded my laptop.
Diffstat (limited to 'tests/unittests/test_datasource/test_smartos.py')
-rw-r--r--tests/unittests/test_datasource/test_smartos.py28
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):