Add new RHEL7 volgroup objects to master
[pykickstart.git] / tests / commands / volgroup.py
blob56e86851dc24856896d21df5b83eb7f0bfa183c2
1 import unittest, shlex
2 from tests.baseclass import *
4 from pykickstart.base import *
5 from pykickstart.errors import *
6 from pykickstart.version import *
7 from pykickstart.commands.volgroup import *
9 class FC3_TestCase(CommandTest):
10 command = "volgroup"
12 def runTest(self):
13 if self.__class__ in (FC3_TestCase, F16_TestCase):
14 def_pesize_str = " --pesize=32768"
15 else:
16 def_pesize_str = ""
18 # --noformat
19 self.assert_parse("volgroup vg.01 --noformat",
20 "volgroup vg.01 --noformat%s --useexisting\n" % def_pesize_str)
21 # --useexisting
22 self.assert_parse("volgroup vg.01 --useexisting",
23 "volgroup vg.01%s --useexisting\n" % def_pesize_str)
25 # --pesize
26 self.assert_parse("volgroup vg.01 pv.01 --pesize=70000",
27 "volgroup vg.01 --pesize=70000 pv.01\n")
29 # assert data types
30 self.assert_type("volgroup", "pesize", "int")
31 self.assert_type("volgroup", "format", "boolean")
32 self.assert_type("volgroup", "preexist", "boolean")
34 # fail - incorrect type
35 self.assert_parse_error("volgroup vg.01 pv.01 --pesize=SIZE", KickstartParseError)
37 # fail - missing name
38 self.assert_parse_error("volgroup", KickstartParseError)
40 # fail - missing list of partitions
41 self.assert_parse_error("volgroup vg01", KickstartValueError)
43 # fail - both members and useexisting specified
44 self.assert_parse_error("volgroup vg.01 --useexisting pv.01 pv.02", KickstartValueError)
46 class F16_TestCase(FC3_TestCase):
47 def runTest(self):
48 FC3_TestCase.runTest(self)
50 if self.__class__ in (FC3_TestCase, F16_TestCase):
51 def_pesize_str = " --pesize=32768"
52 else:
53 def_pesize_str = ""
55 # Pass - correct usage.
56 self.assert_parse("volgroup vg.01 pv.01 --reserved-space=1000",
57 "volgroup vg.01%s --reserved-space=1000 pv.01\n" % def_pesize_str)
58 self.assert_parse("volgroup vg.01 pv.01 --reserved-percent=50",
59 "volgroup vg.01%s --reserved-percent=50 pv.01\n" % def_pesize_str)
61 # Fail - missing required argument.
62 self.assert_parse_error("volgroup vg.01 pv.01 --reserved-space", KickstartParseError)
63 self.assert_parse_error("volgroup vg.01 pv.01 --reserved-percent", KickstartParseError)
65 # Fail - incorrect values.
66 self.assert_parse_error("volgroup vg.01 pv.01 --reserved-space=-1", KickstartValueError)
67 self.assert_parse_error("volgroup vg.01 pv.01 --reserved-percent=0", KickstartValueError)
68 self.assert_parse_error("volgroup vg.01 pv.01 --reserved-percent=100", KickstartValueError)
70 class RHEL7_TestCase(F16_TestCase):
71 def runTest(self):
72 # just run all the old tests with the new class (different PE size
73 # default)
74 F16_TestCase.runTest(self)
76 class F21_TestCase(F16_TestCase):
77 def runTest(self):
78 # just run all the old tests with the new class (different PE size
79 # default)
80 F16_TestCase.runTest(self)
82 if __name__ == "__main__":
83 unittest.main()