~ubuntu-branches/ubuntu/saucy/cloud-init/saucy

« back to all changes in this revision

Viewing changes to tests/unittests/test_datasource/test_smartos.py

  • Committer: Scott Moser
  • Date: 2013-09-21 00:45:57 UTC
  • mfrom: (1.4.6)
  • Revision ID: smoser@ubuntu.com-20130921004557-o8zfowviyrqz02sd
* New upstream snapshot.
  * add 'disk_setup' config module for partitioning disks and
    creating filesystems. (LP: #1218506)

Show diffs side-by-side

added added

removed removed

Lines of Context:
261
261
        self.assertEquals(MOCK_RETURNS['enable_motd_sys_info'],
262
262
                          dsrc.metadata['motd_sys_info'])
263
263
 
 
264
    def test_default_ephemeral(self):
 
265
        # Test to make sure that the builtin config has the ephemeral
 
266
        # configuration.
 
267
        dsrc = self._get_ds()
 
268
        cfg = dsrc.get_config_obj()
 
269
 
 
270
        ret = dsrc.get_data()
 
271
        self.assertTrue(ret)
 
272
 
 
273
        assert 'disk_setup' in cfg
 
274
        assert 'fs_setup' in cfg
 
275
        self.assertIsInstance(cfg['disk_setup'], dict)
 
276
        self.assertIsInstance(cfg['fs_setup'], list)
 
277
 
 
278
    def test_override_builtin_ds(self):
 
279
        # Test to make sure that the built-in DS is overriden
 
280
        data = {}
 
281
        data['disk_setup'] = {'test_dev': {}}
 
282
        data['fs_setup'] = [{'label': 'test_dev'}]
 
283
        data['serial_device'] = '/dev/ttyS2'
 
284
        dsrc = self._get_ds(ds_cfg=data)
 
285
        cfg = dsrc.get_config_obj()
 
286
 
 
287
        ret = dsrc.get_data()
 
288
        self.assertTrue(ret)
 
289
 
 
290
        assert 'disk_setup' in cfg
 
291
        assert 'fs_setup' in cfg
 
292
        self.assertIsInstance(cfg['disk_setup'], dict)
 
293
        self.assertIsInstance(cfg['fs_setup'], list)
 
294
        assert 'test_dev' in cfg['disk_setup']
 
295
        assert 'test_dev' in cfg['fs_setup'][0]['label']
 
296
 
 
297
        self.assertEquals(data['serial_device'], dsrc.seed)
 
298
 
264
299
 
265
300
def apply_patches(patches):
266
301
    ret = []