From 141d14892c54358dd2a1876a74e39f6cf75107db Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Mon, 17 Dec 2012 17:16:27 +0100 Subject: [PATCH] Add test for SPICE parameter list, add missing ones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit β_SPICE_ADDITIONAL_PARAMSβ is supposed to be the full list of SPICE-related KVM hypervisor parameters with the exception of βHV_KVM_SPICE_BINDβ. The new test checks if all parameters starting with βHV_KVM_SPICE_*β are included. Three previously missing parameters are added to the list. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/hypervisor/hv_kvm.py | 3 +++ test/ganeti.hypervisor.hv_kvm_unittest.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index a388ec254..3b2d81ed3 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -77,6 +77,9 @@ _SPICE_ADDITIONAL_PARAMS = frozenset([ constants.HV_KVM_SPICE_ZLIB_GLZ_IMG_COMPR, constants.HV_KVM_SPICE_STREAMING_VIDEO_DETECTION, constants.HV_KVM_SPICE_USE_TLS, + constants.HV_KVM_SPICE_AUDIO_COMPR, + constants.HV_KVM_SPICE_TLS_CIPHERS, + constants.HV_KVM_SPICE_USE_VDAGENT, ]) diff --git a/test/ganeti.hypervisor.hv_kvm_unittest.py b/test/ganeti.hypervisor.hv_kvm_unittest.py index 230efffe4..f401d3351 100755 --- a/test/ganeti.hypervisor.hv_kvm_unittest.py +++ b/test/ganeti.hypervisor.hv_kvm_unittest.py @@ -258,5 +258,20 @@ class TestVersionChecking(testutils.GanetiTestCase): self.assertEqual(parse(help_091), ("0.9.1", 0, 9, 1)) +class TestSpiceParameterList(unittest.TestCase): + def test(self): + params = \ + compat.UniqueFrozenset(getattr(constants, name) + for name in dir(constants) + if name.startswith("HV_KVM_SPICE_")) + + # Exclude some parameters + params -= frozenset([ + constants.HV_KVM_SPICE_BIND, + ]) + + self.assertEqual(hv_kvm._SPICE_ADDITIONAL_PARAMS, params) + + if __name__ == "__main__": testutils.GanetiTestProgram() -- GitLab