1
0

test_virt.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*- coding: utf-8 -*-
  2. """
  3. Validate the virt module
  4. """
  5. from __future__ import absolute_import, print_function, unicode_literals
  6. import pytest
  7. from tests.support.case import ModuleCase
  8. @pytest.mark.requires_salt_modules("virt.get_profiles")
  9. class VirtTest(ModuleCase):
  10. """
  11. Test virt routines
  12. """
  13. def test_default_kvm_profile(self):
  14. """
  15. Test virt.get_profiles with the KVM profile
  16. """
  17. profiles = self.run_function("virt.get_profiles", ["kvm"])
  18. nicp = profiles["nic"]["default"]
  19. self.assertTrue(nicp[0].get("model", "") == "virtio")
  20. self.assertTrue(nicp[0].get("source", "") == "br0")
  21. diskp = profiles["disk"]["default"]
  22. self.assertTrue(diskp[0]["system"].get("model", "") == "virtio")
  23. self.assertTrue(diskp[0]["system"].get("format", "") == "qcow2")
  24. self.assertTrue(diskp[0]["system"].get("size", "") == "8192")
  25. def test_default_esxi_profile(self):
  26. """
  27. Test virt.get_profiles with the ESX profile
  28. """
  29. profiles = self.run_function("virt.get_profiles", ["esxi"])
  30. nicp = profiles["nic"]["default"]
  31. self.assertTrue(nicp[0].get("model", "") == "e1000")
  32. self.assertTrue(nicp[0].get("source", "") == "DEFAULT")
  33. diskp = profiles["disk"]["default"]
  34. self.assertTrue(diskp[0]["system"].get("model", "") == "scsi")
  35. self.assertTrue(diskp[0]["system"].get("format", "") == "vmdk")
  36. self.assertTrue(diskp[0]["system"].get("size", "") == "8192")