File: virt.py

package info (click to toggle)
salt 2014.1.13%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,572 kB
  • ctags: 9,221
  • sloc: python: 155,066; sh: 4,692; xml: 462; makefile: 197
file content (49 lines) | stat: -rw-r--r-- 1,679 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
'''
Validate the virt module
'''

# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath, requires_salt_modules
ensure_in_syspath('../../')

# Import salt libs
import integration


@requires_salt_modules('virt.get_profiles')
class VirtTest(integration.ModuleCase):
    '''
    Test virt routines
    '''

    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']
        self.assertTrue(nicp['eth0'].get('model', '') == 'virtio')
        self.assertTrue(nicp['eth0'].get('bridge', '') == 'br0')
        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']
        self.assertTrue(nicp['eth0'].get('model', '') == 'e1000')
        self.assertTrue(nicp['eth0'].get('bridge', '') == 'DEFAULT')
        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)