2013-09-26 23:41:52 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
'''
|
|
|
|
Validate the virt module
|
|
|
|
'''
|
|
|
|
|
2014-11-21 19:05:13 +00:00
|
|
|
# Import Python libs
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2013-09-26 23:41:52 +00:00
|
|
|
# Import Salt Testing libs
|
2013-09-28 17:57:38 +00:00
|
|
|
from salttesting.helpers import ensure_in_syspath, requires_salt_modules
|
2013-09-26 23:41:52 +00:00
|
|
|
ensure_in_syspath('../../')
|
|
|
|
|
|
|
|
# Import salt libs
|
|
|
|
import integration
|
|
|
|
|
2013-11-27 12:11:45 +00:00
|
|
|
|
2013-09-28 17:57:38 +00:00
|
|
|
@requires_salt_modules('virt.get_profiles')
|
2013-09-26 23:41:52 +00:00
|
|
|
class VirtTest(integration.ModuleCase):
|
|
|
|
'''
|
|
|
|
Test virt routines
|
|
|
|
'''
|
2013-09-28 17:55:15 +00:00
|
|
|
|
2013-09-26 23:41:52 +00:00
|
|
|
def test_default_kvm_profile(self):
|
|
|
|
'''
|
|
|
|
Test virt.get_profiles with the KVM profile
|
|
|
|
'''
|
|
|
|
profiles = self.run_function('virt.get_profiles', ['kvm'])
|
|
|
|
nicp = profiles['nic']['default']
|
2015-03-10 01:51:44 +00:00
|
|
|
self.assertTrue(nicp[0].get('model', '') == 'virtio')
|
|
|
|
self.assertTrue(nicp[0].get('source', '') == 'br0')
|
2013-09-26 23:41:52 +00:00
|
|
|
diskp = profiles['disk']['default']
|
|
|
|
self.assertTrue(diskp[0]['system'].get('model', '') == 'virtio')
|
|
|
|
self.assertTrue(diskp[0]['system'].get('format', '') == 'qcow2')
|
|
|
|
self.assertTrue(diskp[0]['system'].get('size', '') == '8192')
|
|
|
|
|
|
|
|
def test_default_esxi_profile(self):
|
|
|
|
'''
|
|
|
|
Test virt.get_profiles with the ESX profile
|
|
|
|
'''
|
|
|
|
profiles = self.run_function('virt.get_profiles', ['esxi'])
|
|
|
|
nicp = profiles['nic']['default']
|
2015-03-10 01:51:44 +00:00
|
|
|
self.assertTrue(nicp[0].get('model', '') == 'e1000')
|
|
|
|
self.assertTrue(nicp[0].get('source', '') == 'DEFAULT')
|
2013-09-26 23:41:52 +00:00
|
|
|
diskp = profiles['disk']['default']
|
|
|
|
self.assertTrue(diskp[0]['system'].get('model', '') == 'scsi')
|
|
|
|
self.assertTrue(diskp[0]['system'].get('format', '') == 'vmdk')
|
|
|
|
self.assertTrue(diskp[0]['system'].get('size', '') == '8192')
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from integration import run_tests
|
|
|
|
run_tests(VirtTest)
|