Francesco Romani has uploaded a new change for review.

Change subject: tests: add more tests for graphics devices
......................................................................

tests: add more tests for graphics devices

this patch adds a few more sanity tests for
the graphic devices.

Change-Id: I6724ee2c5ce393272b40aa7b08bc5f864123fdc5
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M tests/vmTests.py
1 file changed, 47 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/27901/1

diff --git a/tests/vmTests.py b/tests/vmTests.py
index 53d43fe..38a3078 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -1149,31 +1149,38 @@
             'smp': '8', 'maxVCpus': '160',
             'memSize': '1024', 'memGuaranteedSize': '512'}
 
-        self.confDisplay = (
+        self.confDisplayVnc = (
             {'display': 'vnc', 'displayNetwork': 'vmDisplay'},
 
             {'display': 'vnc', 'displayPort': '-1', 'displayNetwork':
-             'vmDisplay', 'keyboardLayout': 'en-us'},
+             'vmDisplay', 'keyboardLayout': 'en-us'})
 
+        self.confDisplaySpice = (
             {'display': 'qxl', 'displayNetwork': 'vmDisplay'},
 
             {'display': 'qxl', 'displayPort': '-1',
              'displaySecurePort': '-1'})
 
-        self.confDeviceGraphics = (
+        self.confDeviceGraphicsVnc = (
             ({'type': 'graphics', 'device': 'vnc'},),
 
             ({'type': 'graphics', 'device': 'vnc', 'port': '-1',
                 'specParams': {
                     'displayNetwork': 'vmDisplay',
-                    'keyMap': 'en-us'}},),
+                    'keyMap': 'en-us'}},))
 
+        self.confDeviceGraphicsSpice = (
             ({'type': 'graphics', 'device': 'spice'},),
 
             ({'type': 'graphics', 'device': 'spice', 'port': '-1',
                 'tlsPort': '-1', 'specParams': {
                     'spiceSecureChannels':
                     'smain,sinputs,scursor,splayback,srecord,sdisplay'}},))
+
+        self.confDisplay = self.confDisplayVnc + self.confDisplaySpice
+
+        self.confDeviceGraphics = (self.confDeviceGraphicsVnc +
+                                   self.confDeviceGraphicsSpice)
 
     def testGraphicsDeviceLegacy(self):
         for conf in self.confDisplay:
@@ -1221,3 +1228,39 @@
                    {'type': 'graphics', 'device': devType}]
         with FakeVM(self.conf, devices) as fake:
             self.assertRaises(ValueError, fake.buildConfDevices)
+
+    def testGraphicsDeviceSanityLegacy(self):
+        for conf in self.confDisplay:
+            conf.update(self.conf)
+            self.assertTrue(vm.GraphicsDevice.isSupportedDisplayType(conf))
+
+    def testGraphicsDeviceSanity(self):
+        for dev in self.confDeviceGraphics:
+            conf = {'devices': list(dev)}
+            conf.update(self.conf)
+            self.assertTrue(vm.GraphicsDevice.isSupportedDisplayType(conf))
+
+    def testGraphicDeviceUnsupported(self):
+        conf = {'display': 'rdp'}
+        conf.update(self.conf)
+        self.assertFalse(vm.GraphicsDevice.isSupportedDisplayType(conf))
+
+    def testHasSpiceLegacy(self):
+        for conf in self.confDisplaySpice:
+            conf.update(self.conf)
+            with FakeVM(conf) as fake:
+                self.assertTrue(fake.hasSpice)
+
+        for conf in self.confDisplayVnc:
+            conf.update(self.conf)
+            with FakeVM(conf) as fake:
+                self.assertFalse(fake.hasSpice)
+
+    def testHasSpice(self):
+        for dev in self.confDeviceGraphicsSpice:
+            with FakeVM(self.conf, dev) as fake:
+                self.assertTrue(fake.hasSpice)
+
+        for dev in self.confDeviceGraphicsVnc:
+            with FakeVM(self.conf, dev) as fake:
+                self.assertFalse(fake.hasSpice)


-- 
To view, visit http://gerrit.ovirt.org/27901
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6724ee2c5ce393272b40aa7b08bc5f864123fdc5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to