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
):
13 if self
.__class
__ in (FC3_TestCase
, F16_TestCase
):
14 def_pesize_str
= " --pesize=32768"
19 self
.assert_parse("volgroup vg.01 --noformat",
20 "volgroup vg.01 --noformat%s --useexisting\n" % def_pesize_str
)
22 self
.assert_parse("volgroup vg.01 --useexisting",
23 "volgroup vg.01%s --useexisting\n" % def_pesize_str
)
26 self
.assert_parse("volgroup vg.01 pv.01 --pesize=70000",
27 "volgroup vg.01 --pesize=70000 pv.01\n")
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
)
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
):
48 FC3_TestCase
.runTest(self
)
50 if self
.__class
__ in (FC3_TestCase
, F16_TestCase
):
51 def_pesize_str
= " --pesize=32768"
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
):
72 # just run all the old tests with the new class (different PE size
74 F16_TestCase
.runTest(self
)
76 class F21_TestCase(F16_TestCase
):
78 # just run all the old tests with the new class (different PE size
80 F16_TestCase
.runTest(self
)
82 if __name__
== "__main__":