root / test / ganeti.hypervisor_unittest.py @ 415feb2e
History | View | Annotate | Download (1.7 kB)
1 | e695efbf | Iustin Pop | #!/usr/bin/python
|
---|---|---|---|
2 | e695efbf | Iustin Pop | #
|
3 | e695efbf | Iustin Pop | |
4 | e695efbf | Iustin Pop | # Copyright (C) 2010 Google Inc.
|
5 | e695efbf | Iustin Pop | #
|
6 | e695efbf | Iustin Pop | # This program is free software; you can redistribute it and/or modify
|
7 | e695efbf | Iustin Pop | # it under the terms of the GNU General Public License as published by
|
8 | e695efbf | Iustin Pop | # the Free Software Foundation; either version 2 of the License, or
|
9 | e695efbf | Iustin Pop | # (at your option) any later version.
|
10 | e695efbf | Iustin Pop | #
|
11 | e695efbf | Iustin Pop | # This program is distributed in the hope that it will be useful, but
|
12 | e695efbf | Iustin Pop | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | e695efbf | Iustin Pop | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | e695efbf | Iustin Pop | # General Public License for more details.
|
15 | e695efbf | Iustin Pop | #
|
16 | e695efbf | Iustin Pop | # You should have received a copy of the GNU General Public License
|
17 | e695efbf | Iustin Pop | # along with this program; if not, write to the Free Software
|
18 | e695efbf | Iustin Pop | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 | e695efbf | Iustin Pop | # 02110-1301, USA.
|
20 | e695efbf | Iustin Pop | |
21 | e695efbf | Iustin Pop | |
22 | e695efbf | Iustin Pop | """Script for testing hypervisor functionality"""
|
23 | e695efbf | Iustin Pop | |
24 | e695efbf | Iustin Pop | import unittest |
25 | e695efbf | Iustin Pop | |
26 | e695efbf | Iustin Pop | from ganeti import constants |
27 | e695efbf | Iustin Pop | from ganeti import compat |
28 | e695efbf | Iustin Pop | from ganeti import objects |
29 | e695efbf | Iustin Pop | from ganeti import errors |
30 | e695efbf | Iustin Pop | from ganeti import hypervisor |
31 | e695efbf | Iustin Pop | |
32 | e695efbf | Iustin Pop | import testutils |
33 | e695efbf | Iustin Pop | |
34 | e695efbf | Iustin Pop | |
35 | e695efbf | Iustin Pop | class TestParameters(unittest.TestCase): |
36 | e695efbf | Iustin Pop | def test(self): |
37 | e695efbf | Iustin Pop | for hv, const_params in constants.HVC_DEFAULTS.items(): |
38 | e695efbf | Iustin Pop | hyp = hypervisor.GetHypervisorClass(hv) |
39 | e695efbf | Iustin Pop | for pname in const_params: |
40 | e695efbf | Iustin Pop | self.assertTrue(pname in hyp.PARAMETERS, |
41 | e695efbf | Iustin Pop | "Hypervisor %s: parameter %s defined in constants"
|
42 | e695efbf | Iustin Pop | " but not in the permitted hypervisor parameters" %
|
43 | e695efbf | Iustin Pop | (hv, pname)) |
44 | e695efbf | Iustin Pop | for pname in hyp.PARAMETERS: |
45 | e695efbf | Iustin Pop | self.assertTrue(pname in const_params, |
46 | e695efbf | Iustin Pop | "Hypervisor %s: parameter %s defined in the hypervisor"
|
47 | e695efbf | Iustin Pop | " but missing a default value" %
|
48 | e695efbf | Iustin Pop | (hv, pname)) |
49 | e695efbf | Iustin Pop | |
50 | e695efbf | Iustin Pop | |
51 | e695efbf | Iustin Pop | if __name__ == "__main__": |
52 | e695efbf | Iustin Pop | testutils.GanetiTestProgram() |