root / test / ganeti.rapi.rlib2_unittest.py @ 7578ab0a
History | View | Annotate | Download (18 kB)
1 | 6395cebb | Michael Hanselmann | #!/usr/bin/python
|
---|---|---|---|
2 | 6395cebb | Michael Hanselmann | #
|
3 | 6395cebb | Michael Hanselmann | |
4 | 6395cebb | Michael Hanselmann | # Copyright (C) 2010 Google Inc.
|
5 | 6395cebb | Michael Hanselmann | #
|
6 | 6395cebb | Michael Hanselmann | # This program is free software; you can redistribute it and/or modify
|
7 | 6395cebb | Michael Hanselmann | # it under the terms of the GNU General Public License as published by
|
8 | 6395cebb | Michael Hanselmann | # the Free Software Foundation; either version 2 of the License, or
|
9 | 6395cebb | Michael Hanselmann | # (at your option) any later version.
|
10 | 6395cebb | Michael Hanselmann | #
|
11 | 6395cebb | Michael Hanselmann | # This program is distributed in the hope that it will be useful, but
|
12 | 6395cebb | Michael Hanselmann | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 6395cebb | Michael Hanselmann | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 6395cebb | Michael Hanselmann | # General Public License for more details.
|
15 | 6395cebb | Michael Hanselmann | #
|
16 | 6395cebb | Michael Hanselmann | # You should have received a copy of the GNU General Public License
|
17 | 6395cebb | Michael Hanselmann | # along with this program; if not, write to the Free Software
|
18 | 6395cebb | Michael Hanselmann | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 | 6395cebb | Michael Hanselmann | # 02110-1301, USA.
|
20 | 6395cebb | Michael Hanselmann | |
21 | 6395cebb | Michael Hanselmann | |
22 | 6395cebb | Michael Hanselmann | """Script for unittesting the RAPI rlib2 module
|
23 | 6395cebb | Michael Hanselmann |
|
24 | 6395cebb | Michael Hanselmann | """
|
25 | 6395cebb | Michael Hanselmann | |
26 | 6395cebb | Michael Hanselmann | |
27 | 6395cebb | Michael Hanselmann | import unittest |
28 | 6395cebb | Michael Hanselmann | import tempfile |
29 | 6395cebb | Michael Hanselmann | |
30 | 6395cebb | Michael Hanselmann | from ganeti import constants |
31 | 6395cebb | Michael Hanselmann | from ganeti import opcodes |
32 | 6395cebb | Michael Hanselmann | from ganeti import compat |
33 | 6395cebb | Michael Hanselmann | from ganeti import http |
34 | b82d4c5e | Michael Hanselmann | from ganeti import query |
35 | 6395cebb | Michael Hanselmann | |
36 | 6395cebb | Michael Hanselmann | from ganeti.rapi import rlib2 |
37 | 6395cebb | Michael Hanselmann | |
38 | 6395cebb | Michael Hanselmann | import testutils |
39 | 6395cebb | Michael Hanselmann | |
40 | 6395cebb | Michael Hanselmann | |
41 | b82d4c5e | Michael Hanselmann | class TestConstants(unittest.TestCase): |
42 | b82d4c5e | Michael Hanselmann | def testConsole(self): |
43 | b82d4c5e | Michael Hanselmann | # Exporting the console field without authentication might expose
|
44 | b82d4c5e | Michael Hanselmann | # information
|
45 | b82d4c5e | Michael Hanselmann | assert "console" in query.INSTANCE_FIELDS |
46 | b82d4c5e | Michael Hanselmann | self.assertTrue("console" not in rlib2.I_FIELDS) |
47 | b82d4c5e | Michael Hanselmann | |
48 | b82d4c5e | Michael Hanselmann | |
49 | 6395cebb | Michael Hanselmann | class TestParseInstanceCreateRequestVersion1(testutils.GanetiTestCase): |
50 | 6395cebb | Michael Hanselmann | def setUp(self): |
51 | 6395cebb | Michael Hanselmann | testutils.GanetiTestCase.setUp(self)
|
52 | 6395cebb | Michael Hanselmann | |
53 | 6395cebb | Michael Hanselmann | self.Parse = rlib2._ParseInstanceCreateRequestVersion1
|
54 | 6395cebb | Michael Hanselmann | |
55 | 6395cebb | Michael Hanselmann | def test(self): |
56 | 6395cebb | Michael Hanselmann | disk_variants = [ |
57 | 6395cebb | Michael Hanselmann | # No disks
|
58 | 6395cebb | Michael Hanselmann | [], |
59 | 6395cebb | Michael Hanselmann | |
60 | 6395cebb | Michael Hanselmann | # Two disks
|
61 | 6395cebb | Michael Hanselmann | [{"size": 5, }, {"size": 100, }], |
62 | 6395cebb | Michael Hanselmann | |
63 | 6395cebb | Michael Hanselmann | # Disk with mode
|
64 | 6395cebb | Michael Hanselmann | [{"size": 123, "mode": constants.DISK_RDWR, }], |
65 | 6395cebb | Michael Hanselmann | ] |
66 | 6395cebb | Michael Hanselmann | |
67 | 6395cebb | Michael Hanselmann | nic_variants = [ |
68 | 6395cebb | Michael Hanselmann | # No NIC
|
69 | 6395cebb | Michael Hanselmann | [], |
70 | 6395cebb | Michael Hanselmann | |
71 | 6395cebb | Michael Hanselmann | # Three NICs
|
72 | 6395cebb | Michael Hanselmann | [{}, {}, {}], |
73 | 6395cebb | Michael Hanselmann | |
74 | 6395cebb | Michael Hanselmann | # Two NICs
|
75 | 6395cebb | Michael Hanselmann | [ |
76 | 54dc4fdb | Michael Hanselmann | { "ip": "192.0.2.6", "mode": constants.NIC_MODE_ROUTED, |
77 | 7be048f0 | Michael Hanselmann | "mac": "01:23:45:67:68:9A", |
78 | 7be048f0 | Michael Hanselmann | }, |
79 | ba05464f | Guido Trotter | { "mode": constants.NIC_MODE_BRIDGED, "link": "br1" }, |
80 | 6395cebb | Michael Hanselmann | ], |
81 | 6395cebb | Michael Hanselmann | ] |
82 | 6395cebb | Michael Hanselmann | |
83 | 6395cebb | Michael Hanselmann | beparam_variants = [ |
84 | 6395cebb | Michael Hanselmann | None,
|
85 | 6395cebb | Michael Hanselmann | {}, |
86 | 6395cebb | Michael Hanselmann | { constants.BE_VCPUS: 2, },
|
87 | 6395cebb | Michael Hanselmann | { constants.BE_MEMORY: 123, },
|
88 | 6395cebb | Michael Hanselmann | { constants.BE_VCPUS: 2,
|
89 | 6395cebb | Michael Hanselmann | constants.BE_MEMORY: 1024,
|
90 | 6395cebb | Michael Hanselmann | constants.BE_AUTO_BALANCE: True, }
|
91 | 6395cebb | Michael Hanselmann | ] |
92 | 6395cebb | Michael Hanselmann | |
93 | 6395cebb | Michael Hanselmann | hvparam_variants = [ |
94 | 6395cebb | Michael Hanselmann | None,
|
95 | 6395cebb | Michael Hanselmann | { constants.HV_BOOT_ORDER: "anc", },
|
96 | 6395cebb | Michael Hanselmann | { constants.HV_KERNEL_PATH: "/boot/fookernel",
|
97 | 6395cebb | Michael Hanselmann | constants.HV_ROOT_PATH: "/dev/hda1", },
|
98 | 6395cebb | Michael Hanselmann | ] |
99 | 6395cebb | Michael Hanselmann | |
100 | 6395cebb | Michael Hanselmann | for mode in [constants.INSTANCE_CREATE, constants.INSTANCE_IMPORT]: |
101 | 6395cebb | Michael Hanselmann | for nics in nic_variants: |
102 | 6395cebb | Michael Hanselmann | for disk_template in constants.DISK_TEMPLATES: |
103 | 6395cebb | Michael Hanselmann | for disks in disk_variants: |
104 | 6395cebb | Michael Hanselmann | for beparams in beparam_variants: |
105 | 6395cebb | Michael Hanselmann | for hvparams in hvparam_variants: |
106 | 6395cebb | Michael Hanselmann | data = { |
107 | 6395cebb | Michael Hanselmann | "name": "inst1.example.com", |
108 | 6395cebb | Michael Hanselmann | "hypervisor": constants.HT_FAKE,
|
109 | 6395cebb | Michael Hanselmann | "disks": disks,
|
110 | 6395cebb | Michael Hanselmann | "nics": nics,
|
111 | 6395cebb | Michael Hanselmann | "mode": mode,
|
112 | 6395cebb | Michael Hanselmann | "disk_template": disk_template,
|
113 | 130f0966 | Iustin Pop | "os": "debootstrap", |
114 | 6395cebb | Michael Hanselmann | } |
115 | 6395cebb | Michael Hanselmann | |
116 | 6395cebb | Michael Hanselmann | if beparams is not None: |
117 | 6395cebb | Michael Hanselmann | data["beparams"] = beparams
|
118 | 6395cebb | Michael Hanselmann | |
119 | 6395cebb | Michael Hanselmann | if hvparams is not None: |
120 | 6395cebb | Michael Hanselmann | data["hvparams"] = hvparams
|
121 | 6395cebb | Michael Hanselmann | |
122 | 6395cebb | Michael Hanselmann | for dry_run in [False, True]: |
123 | 6395cebb | Michael Hanselmann | op = self.Parse(data, dry_run)
|
124 | e1530b10 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpInstanceCreate)) |
125 | 6395cebb | Michael Hanselmann | self.assertEqual(op.mode, mode)
|
126 | 6395cebb | Michael Hanselmann | self.assertEqual(op.disk_template, disk_template)
|
127 | 6395cebb | Michael Hanselmann | self.assertEqual(op.dry_run, dry_run)
|
128 | 6395cebb | Michael Hanselmann | self.assertEqual(len(op.disks), len(disks)) |
129 | 6395cebb | Michael Hanselmann | self.assertEqual(len(op.nics), len(nics)) |
130 | 6395cebb | Michael Hanselmann | |
131 | 7be048f0 | Michael Hanselmann | for opdisk, disk in zip(op.disks, disks): |
132 | 7be048f0 | Michael Hanselmann | for key in constants.IDISK_PARAMS: |
133 | 7be048f0 | Michael Hanselmann | self.assertEqual(opdisk.get(key), disk.get(key))
|
134 | 7be048f0 | Michael Hanselmann | self.assertFalse("unknown" in opdisk) |
135 | 7be048f0 | Michael Hanselmann | |
136 | 7be048f0 | Michael Hanselmann | for opnic, nic in zip(op.nics, nics): |
137 | 7be048f0 | Michael Hanselmann | for key in constants.INIC_PARAMS: |
138 | 7be048f0 | Michael Hanselmann | self.assertEqual(opnic.get(key), nic.get(key))
|
139 | 7be048f0 | Michael Hanselmann | self.assertFalse("unknown" in opnic) |
140 | 7be048f0 | Michael Hanselmann | self.assertFalse("foobar" in opnic) |
141 | 6395cebb | Michael Hanselmann | |
142 | 6395cebb | Michael Hanselmann | if beparams is None: |
143 | 526a662a | Michael Hanselmann | self.assertFalse(hasattr(op, "beparams")) |
144 | 6395cebb | Michael Hanselmann | else:
|
145 | 6395cebb | Michael Hanselmann | self.assertEqualValues(op.beparams, beparams)
|
146 | 6395cebb | Michael Hanselmann | |
147 | 6395cebb | Michael Hanselmann | if hvparams is None: |
148 | 526a662a | Michael Hanselmann | self.assertFalse(hasattr(op, "hvparams")) |
149 | 6395cebb | Michael Hanselmann | else:
|
150 | 6395cebb | Michael Hanselmann | self.assertEqualValues(op.hvparams, hvparams)
|
151 | 6395cebb | Michael Hanselmann | |
152 | 526a662a | Michael Hanselmann | def testLegacyName(self): |
153 | 526a662a | Michael Hanselmann | name = "inst29128.example.com"
|
154 | 526a662a | Michael Hanselmann | data = { |
155 | 526a662a | Michael Hanselmann | "name": name,
|
156 | 526a662a | Michael Hanselmann | "disks": [],
|
157 | 526a662a | Michael Hanselmann | "nics": [],
|
158 | 526a662a | Michael Hanselmann | "mode": constants.INSTANCE_CREATE,
|
159 | 526a662a | Michael Hanselmann | "disk_template": constants.DT_PLAIN,
|
160 | 526a662a | Michael Hanselmann | } |
161 | 526a662a | Michael Hanselmann | op = self.Parse(data, False) |
162 | 526a662a | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpInstanceCreate)) |
163 | 526a662a | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
164 | 526a662a | Michael Hanselmann | self.assertFalse(hasattr(op, "name")) |
165 | 526a662a | Michael Hanselmann | |
166 | 526a662a | Michael Hanselmann | # Define both
|
167 | 526a662a | Michael Hanselmann | data = { |
168 | 526a662a | Michael Hanselmann | "name": name,
|
169 | 526a662a | Michael Hanselmann | "instance_name": "other.example.com", |
170 | 526a662a | Michael Hanselmann | "disks": [],
|
171 | 526a662a | Michael Hanselmann | "nics": [],
|
172 | 526a662a | Michael Hanselmann | "mode": constants.INSTANCE_CREATE,
|
173 | 526a662a | Michael Hanselmann | "disk_template": constants.DT_PLAIN,
|
174 | 526a662a | Michael Hanselmann | } |
175 | 526a662a | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, data, False) |
176 | 526a662a | Michael Hanselmann | |
177 | 526a662a | Michael Hanselmann | def testLegacyOs(self): |
178 | 526a662a | Michael Hanselmann | name = "inst4673.example.com"
|
179 | 526a662a | Michael Hanselmann | os = "linux29206"
|
180 | 526a662a | Michael Hanselmann | data = { |
181 | 526a662a | Michael Hanselmann | "name": name,
|
182 | 526a662a | Michael Hanselmann | "os_type": os,
|
183 | 526a662a | Michael Hanselmann | "disks": [],
|
184 | 526a662a | Michael Hanselmann | "nics": [],
|
185 | 526a662a | Michael Hanselmann | "mode": constants.INSTANCE_CREATE,
|
186 | 526a662a | Michael Hanselmann | "disk_template": constants.DT_PLAIN,
|
187 | 526a662a | Michael Hanselmann | } |
188 | 526a662a | Michael Hanselmann | op = self.Parse(data, False) |
189 | 526a662a | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpInstanceCreate)) |
190 | 526a662a | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
191 | 526a662a | Michael Hanselmann | self.assertEqual(op.os_type, os)
|
192 | 526a662a | Michael Hanselmann | self.assertFalse(hasattr(op, "os")) |
193 | 526a662a | Michael Hanselmann | |
194 | 526a662a | Michael Hanselmann | # Define both
|
195 | 526a662a | Michael Hanselmann | data = { |
196 | 526a662a | Michael Hanselmann | "instance_name": name,
|
197 | 526a662a | Michael Hanselmann | "os": os,
|
198 | 526a662a | Michael Hanselmann | "os_type": "linux9584", |
199 | 526a662a | Michael Hanselmann | "disks": [],
|
200 | 526a662a | Michael Hanselmann | "nics": [],
|
201 | 526a662a | Michael Hanselmann | "mode": constants.INSTANCE_CREATE,
|
202 | 526a662a | Michael Hanselmann | "disk_template": constants.DT_PLAIN,
|
203 | 526a662a | Michael Hanselmann | } |
204 | 526a662a | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, data, False) |
205 | 526a662a | Michael Hanselmann | |
206 | 6395cebb | Michael Hanselmann | def testErrors(self): |
207 | 6395cebb | Michael Hanselmann | # Test all required fields
|
208 | 6395cebb | Michael Hanselmann | reqfields = { |
209 | 6395cebb | Michael Hanselmann | "name": "inst1.example.com", |
210 | 6395cebb | Michael Hanselmann | "disks": [],
|
211 | 6395cebb | Michael Hanselmann | "nics": [],
|
212 | 6395cebb | Michael Hanselmann | "mode": constants.INSTANCE_CREATE,
|
213 | 130f0966 | Iustin Pop | "disk_template": constants.DT_PLAIN,
|
214 | 6395cebb | Michael Hanselmann | } |
215 | 6395cebb | Michael Hanselmann | |
216 | 6395cebb | Michael Hanselmann | for name in reqfields.keys(): |
217 | 6395cebb | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, |
218 | 6395cebb | Michael Hanselmann | dict(i for i in reqfields.iteritems() if i[0] != name), |
219 | 6395cebb | Michael Hanselmann | False)
|
220 | 6395cebb | Michael Hanselmann | |
221 | 6395cebb | Michael Hanselmann | # Invalid disks and nics
|
222 | 6395cebb | Michael Hanselmann | for field in ["disks", "nics"]: |
223 | 526a662a | Michael Hanselmann | invalid_values = [None, 1, "", {}, [1, 2, 3], ["hda1", "hda2"], |
224 | 526a662a | Michael Hanselmann | [{"_unknown_": 999, }]] |
225 | 6395cebb | Michael Hanselmann | |
226 | 6395cebb | Michael Hanselmann | for invvalue in invalid_values: |
227 | 6395cebb | Michael Hanselmann | data = reqfields.copy() |
228 | 6395cebb | Michael Hanselmann | data[field] = invvalue |
229 | 6395cebb | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, data, False) |
230 | 6395cebb | Michael Hanselmann | |
231 | 6395cebb | Michael Hanselmann | |
232 | ebeb600f | Michael Hanselmann | class TestParseExportInstanceRequest(testutils.GanetiTestCase): |
233 | ebeb600f | Michael Hanselmann | def setUp(self): |
234 | ebeb600f | Michael Hanselmann | testutils.GanetiTestCase.setUp(self)
|
235 | ebeb600f | Michael Hanselmann | |
236 | ebeb600f | Michael Hanselmann | self.Parse = rlib2._ParseExportInstanceRequest
|
237 | ebeb600f | Michael Hanselmann | |
238 | ebeb600f | Michael Hanselmann | def test(self): |
239 | ebeb600f | Michael Hanselmann | name = "instmoo"
|
240 | ebeb600f | Michael Hanselmann | data = { |
241 | ebeb600f | Michael Hanselmann | "mode": constants.EXPORT_MODE_REMOTE,
|
242 | ebeb600f | Michael Hanselmann | "destination": [(1, 2, 3), (99, 99, 99)], |
243 | ebeb600f | Michael Hanselmann | "shutdown": True, |
244 | ebeb600f | Michael Hanselmann | "remove_instance": True, |
245 | 07ce3e70 | Michael Hanselmann | "x509_key_name": ["name", "hash"], |
246 | 07ce3e70 | Michael Hanselmann | "destination_x509_ca": "---cert---" |
247 | ebeb600f | Michael Hanselmann | } |
248 | ebeb600f | Michael Hanselmann | op = self.Parse(name, data)
|
249 | 4ff922a2 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpBackupExport)) |
250 | ebeb600f | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
251 | ebeb600f | Michael Hanselmann | self.assertEqual(op.mode, constants.EXPORT_MODE_REMOTE)
|
252 | ebeb600f | Michael Hanselmann | self.assertEqual(op.shutdown, True) |
253 | ebeb600f | Michael Hanselmann | self.assertEqual(op.remove_instance, True) |
254 | ebeb600f | Michael Hanselmann | self.assertEqualValues(op.x509_key_name, ("name", "hash")) |
255 | 07ce3e70 | Michael Hanselmann | self.assertEqual(op.destination_x509_ca, "---cert---") |
256 | ebeb600f | Michael Hanselmann | |
257 | ebeb600f | Michael Hanselmann | def testDefaults(self): |
258 | ebeb600f | Michael Hanselmann | name = "inst1"
|
259 | ebeb600f | Michael Hanselmann | data = { |
260 | ebeb600f | Michael Hanselmann | "destination": "node2", |
261 | ebeb600f | Michael Hanselmann | "shutdown": False, |
262 | ebeb600f | Michael Hanselmann | } |
263 | ebeb600f | Michael Hanselmann | op = self.Parse(name, data)
|
264 | 4ff922a2 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpBackupExport)) |
265 | ebeb600f | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
266 | 07ce3e70 | Michael Hanselmann | self.assertEqual(op.target_node, "node2") |
267 | 07ce3e70 | Michael Hanselmann | self.assertFalse(hasattr(op, "mode")) |
268 | 07ce3e70 | Michael Hanselmann | self.assertFalse(hasattr(op, "remove_instance")) |
269 | 07ce3e70 | Michael Hanselmann | self.assertFalse(hasattr(op, "destination")) |
270 | ebeb600f | Michael Hanselmann | |
271 | ebeb600f | Michael Hanselmann | def testErrors(self): |
272 | ebeb600f | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, "err1", |
273 | ebeb600f | Michael Hanselmann | { "remove_instance": "True", }) |
274 | ebeb600f | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, "err1", |
275 | ebeb600f | Michael Hanselmann | { "remove_instance": "False", }) |
276 | ebeb600f | Michael Hanselmann | |
277 | ebeb600f | Michael Hanselmann | |
278 | 5823e0d2 | Michael Hanselmann | class TestParseMigrateInstanceRequest(testutils.GanetiTestCase): |
279 | 5823e0d2 | Michael Hanselmann | def setUp(self): |
280 | 5823e0d2 | Michael Hanselmann | testutils.GanetiTestCase.setUp(self)
|
281 | 5823e0d2 | Michael Hanselmann | |
282 | 5823e0d2 | Michael Hanselmann | self.Parse = rlib2._ParseMigrateInstanceRequest
|
283 | 5823e0d2 | Michael Hanselmann | |
284 | 5823e0d2 | Michael Hanselmann | def test(self): |
285 | 5823e0d2 | Michael Hanselmann | name = "instYooho6ek"
|
286 | 5823e0d2 | Michael Hanselmann | |
287 | 5823e0d2 | Michael Hanselmann | for cleanup in [False, True]: |
288 | 5823e0d2 | Michael Hanselmann | for mode in constants.HT_MIGRATION_MODES: |
289 | 5823e0d2 | Michael Hanselmann | data = { |
290 | 5823e0d2 | Michael Hanselmann | "cleanup": cleanup,
|
291 | 5823e0d2 | Michael Hanselmann | "mode": mode,
|
292 | 5823e0d2 | Michael Hanselmann | } |
293 | 5823e0d2 | Michael Hanselmann | op = self.Parse(name, data)
|
294 | 75c866c2 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpInstanceMigrate)) |
295 | 5823e0d2 | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
296 | 5823e0d2 | Michael Hanselmann | self.assertEqual(op.mode, mode)
|
297 | 5823e0d2 | Michael Hanselmann | self.assertEqual(op.cleanup, cleanup)
|
298 | 5823e0d2 | Michael Hanselmann | |
299 | 5823e0d2 | Michael Hanselmann | def testDefaults(self): |
300 | 5823e0d2 | Michael Hanselmann | name = "instnohZeex0"
|
301 | 5823e0d2 | Michael Hanselmann | |
302 | 5823e0d2 | Michael Hanselmann | op = self.Parse(name, {})
|
303 | 75c866c2 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpInstanceMigrate)) |
304 | 5823e0d2 | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
305 | c1a27c9a | Michael Hanselmann | self.assertFalse(hasattr(op, "mode")) |
306 | c1a27c9a | Michael Hanselmann | self.assertFalse(hasattr(op, "cleanup")) |
307 | 5823e0d2 | Michael Hanselmann | |
308 | 5823e0d2 | Michael Hanselmann | |
309 | d56e7dc7 | Michael Hanselmann | class TestParseRenameInstanceRequest(testutils.GanetiTestCase): |
310 | d56e7dc7 | Michael Hanselmann | def setUp(self): |
311 | d56e7dc7 | Michael Hanselmann | testutils.GanetiTestCase.setUp(self)
|
312 | d56e7dc7 | Michael Hanselmann | |
313 | d56e7dc7 | Michael Hanselmann | self.Parse = rlib2._ParseRenameInstanceRequest
|
314 | d56e7dc7 | Michael Hanselmann | |
315 | d56e7dc7 | Michael Hanselmann | def test(self): |
316 | d56e7dc7 | Michael Hanselmann | name = "instij0eeph7"
|
317 | d56e7dc7 | Michael Hanselmann | |
318 | d56e7dc7 | Michael Hanselmann | for new_name in ["ua0aiyoo", "fai3ongi"]: |
319 | d56e7dc7 | Michael Hanselmann | for ip_check in [False, True]: |
320 | d56e7dc7 | Michael Hanselmann | for name_check in [False, True]: |
321 | d56e7dc7 | Michael Hanselmann | data = { |
322 | d56e7dc7 | Michael Hanselmann | "new_name": new_name,
|
323 | d56e7dc7 | Michael Hanselmann | "ip_check": ip_check,
|
324 | d56e7dc7 | Michael Hanselmann | "name_check": name_check,
|
325 | d56e7dc7 | Michael Hanselmann | } |
326 | d56e7dc7 | Michael Hanselmann | |
327 | d56e7dc7 | Michael Hanselmann | op = self.Parse(name, data)
|
328 | 5659e2e2 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpInstanceRename)) |
329 | d56e7dc7 | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
330 | d56e7dc7 | Michael Hanselmann | self.assertEqual(op.new_name, new_name)
|
331 | d56e7dc7 | Michael Hanselmann | self.assertEqual(op.ip_check, ip_check)
|
332 | d56e7dc7 | Michael Hanselmann | self.assertEqual(op.name_check, name_check)
|
333 | d56e7dc7 | Michael Hanselmann | |
334 | d56e7dc7 | Michael Hanselmann | def testDefaults(self): |
335 | d56e7dc7 | Michael Hanselmann | name = "instahchie3t"
|
336 | d56e7dc7 | Michael Hanselmann | |
337 | d56e7dc7 | Michael Hanselmann | for new_name in ["thag9mek", "quees7oh"]: |
338 | d56e7dc7 | Michael Hanselmann | data = { |
339 | d56e7dc7 | Michael Hanselmann | "new_name": new_name,
|
340 | d56e7dc7 | Michael Hanselmann | } |
341 | d56e7dc7 | Michael Hanselmann | |
342 | d56e7dc7 | Michael Hanselmann | op = self.Parse(name, data)
|
343 | 5659e2e2 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpInstanceRename)) |
344 | d56e7dc7 | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
345 | d56e7dc7 | Michael Hanselmann | self.assertEqual(op.new_name, new_name)
|
346 | 88bc199a | Michael Hanselmann | self.assertFalse(hasattr(op, "ip_check")) |
347 | 88bc199a | Michael Hanselmann | self.assertFalse(hasattr(op, "name_check")) |
348 | d56e7dc7 | Michael Hanselmann | |
349 | d56e7dc7 | Michael Hanselmann | |
350 | 3882937a | Michael Hanselmann | class TestParseModifyInstanceRequest(testutils.GanetiTestCase): |
351 | 3882937a | Michael Hanselmann | def setUp(self): |
352 | 3882937a | Michael Hanselmann | testutils.GanetiTestCase.setUp(self)
|
353 | 3882937a | Michael Hanselmann | |
354 | 3882937a | Michael Hanselmann | self.Parse = rlib2._ParseModifyInstanceRequest
|
355 | 3882937a | Michael Hanselmann | |
356 | 3882937a | Michael Hanselmann | def test(self): |
357 | 3882937a | Michael Hanselmann | name = "instush8gah"
|
358 | 3882937a | Michael Hanselmann | |
359 | 3882937a | Michael Hanselmann | test_disks = [ |
360 | 3882937a | Michael Hanselmann | [], |
361 | 3882937a | Michael Hanselmann | [(1, { constants.IDISK_MODE: constants.DISK_RDWR, })],
|
362 | 3882937a | Michael Hanselmann | ] |
363 | 3882937a | Michael Hanselmann | |
364 | 3882937a | Michael Hanselmann | for osparams in [{}, { "some": "value", "other": "Hello World", }]: |
365 | 3882937a | Michael Hanselmann | for hvparams in [{}, { constants.HV_KERNEL_PATH: "/some/kernel", }]: |
366 | 3882937a | Michael Hanselmann | for beparams in [{}, { constants.BE_MEMORY: 128, }]: |
367 | 3882937a | Michael Hanselmann | for force in [False, True]: |
368 | 3882937a | Michael Hanselmann | for nics in [[], [(0, { constants.INIC_IP: "192.0.2.1", })]]: |
369 | 3882937a | Michael Hanselmann | for disks in test_disks: |
370 | 3882937a | Michael Hanselmann | for disk_template in constants.DISK_TEMPLATES: |
371 | 3882937a | Michael Hanselmann | data = { |
372 | 3882937a | Michael Hanselmann | "osparams": osparams,
|
373 | 3882937a | Michael Hanselmann | "hvparams": hvparams,
|
374 | 3882937a | Michael Hanselmann | "beparams": beparams,
|
375 | 3882937a | Michael Hanselmann | "nics": nics,
|
376 | 3882937a | Michael Hanselmann | "disks": disks,
|
377 | 3882937a | Michael Hanselmann | "force": force,
|
378 | 3882937a | Michael Hanselmann | "disk_template": disk_template,
|
379 | 3882937a | Michael Hanselmann | } |
380 | 3882937a | Michael Hanselmann | |
381 | 3882937a | Michael Hanselmann | op = self.Parse(name, data)
|
382 | 9a3cc7ae | Iustin Pop | self.assert_(isinstance(op, opcodes.OpInstanceSetParams)) |
383 | 3882937a | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
384 | 3882937a | Michael Hanselmann | self.assertEqual(op.hvparams, hvparams)
|
385 | 3882937a | Michael Hanselmann | self.assertEqual(op.beparams, beparams)
|
386 | 3882937a | Michael Hanselmann | self.assertEqual(op.osparams, osparams)
|
387 | 3882937a | Michael Hanselmann | self.assertEqual(op.force, force)
|
388 | 3882937a | Michael Hanselmann | self.assertEqual(op.nics, nics)
|
389 | 3882937a | Michael Hanselmann | self.assertEqual(op.disks, disks)
|
390 | 3882937a | Michael Hanselmann | self.assertEqual(op.disk_template, disk_template)
|
391 | ee5549c7 | Michael Hanselmann | self.assertFalse(hasattr(op, "remote_node")) |
392 | ee5549c7 | Michael Hanselmann | self.assertFalse(hasattr(op, "os_name")) |
393 | ee5549c7 | Michael Hanselmann | self.assertFalse(hasattr(op, "force_variant")) |
394 | 3882937a | Michael Hanselmann | |
395 | 3882937a | Michael Hanselmann | def testDefaults(self): |
396 | 3882937a | Michael Hanselmann | name = "instir8aish31"
|
397 | 3882937a | Michael Hanselmann | |
398 | 3882937a | Michael Hanselmann | op = self.Parse(name, {})
|
399 | 9a3cc7ae | Iustin Pop | self.assert_(isinstance(op, opcodes.OpInstanceSetParams)) |
400 | 3882937a | Michael Hanselmann | self.assertEqual(op.instance_name, name)
|
401 | ee5549c7 | Michael Hanselmann | for i in ["hvparams", "beparams", "osparams", "force", "nics", "disks", |
402 | ee5549c7 | Michael Hanselmann | "disk_template", "remote_node", "os_name", "force_variant"]: |
403 | ee5549c7 | Michael Hanselmann | self.assertFalse(hasattr(op, i)) |
404 | 3882937a | Michael Hanselmann | |
405 | 3882937a | Michael Hanselmann | |
406 | c744425f | Michael Hanselmann | class TestParseInstanceReinstallRequest(testutils.GanetiTestCase): |
407 | c744425f | Michael Hanselmann | def setUp(self): |
408 | c744425f | Michael Hanselmann | testutils.GanetiTestCase.setUp(self)
|
409 | c744425f | Michael Hanselmann | |
410 | c744425f | Michael Hanselmann | self.Parse = rlib2._ParseInstanceReinstallRequest
|
411 | c744425f | Michael Hanselmann | |
412 | c744425f | Michael Hanselmann | def _Check(self, ops, name): |
413 | c744425f | Michael Hanselmann | expcls = [ |
414 | ee3e37a7 | Iustin Pop | opcodes.OpInstanceShutdown, |
415 | 5073fd8f | Iustin Pop | opcodes.OpInstanceReinstall, |
416 | c873d91c | Iustin Pop | opcodes.OpInstanceStartup, |
417 | c744425f | Michael Hanselmann | ] |
418 | c744425f | Michael Hanselmann | |
419 | c744425f | Michael Hanselmann | self.assert_(compat.all(isinstance(op, exp) |
420 | c744425f | Michael Hanselmann | for op, exp in zip(ops, expcls))) |
421 | c744425f | Michael Hanselmann | self.assert_(compat.all(op.instance_name == name for op in ops)) |
422 | c744425f | Michael Hanselmann | |
423 | c744425f | Michael Hanselmann | def test(self): |
424 | c744425f | Michael Hanselmann | name = "shoo0tihohma"
|
425 | c744425f | Michael Hanselmann | |
426 | c744425f | Michael Hanselmann | ops = self.Parse(name, {"os": "sys1", "start": True,}) |
427 | c744425f | Michael Hanselmann | self.assertEqual(len(ops), 3) |
428 | c744425f | Michael Hanselmann | self._Check(ops, name)
|
429 | c744425f | Michael Hanselmann | self.assertEqual(ops[1].os_type, "sys1") |
430 | c744425f | Michael Hanselmann | self.assertFalse(ops[1].osparams) |
431 | c744425f | Michael Hanselmann | |
432 | c744425f | Michael Hanselmann | ops = self.Parse(name, {"os": "sys2", "start": False,}) |
433 | c744425f | Michael Hanselmann | self.assertEqual(len(ops), 2) |
434 | c744425f | Michael Hanselmann | self._Check(ops, name)
|
435 | c744425f | Michael Hanselmann | self.assertEqual(ops[1].os_type, "sys2") |
436 | c744425f | Michael Hanselmann | |
437 | c744425f | Michael Hanselmann | osparams = { |
438 | c744425f | Michael Hanselmann | "reformat": "1", |
439 | c744425f | Michael Hanselmann | } |
440 | c744425f | Michael Hanselmann | ops = self.Parse(name, {"os": "sys4035", "start": True, |
441 | c744425f | Michael Hanselmann | "osparams": osparams,})
|
442 | c744425f | Michael Hanselmann | self.assertEqual(len(ops), 3) |
443 | c744425f | Michael Hanselmann | self._Check(ops, name)
|
444 | c744425f | Michael Hanselmann | self.assertEqual(ops[1].os_type, "sys4035") |
445 | c744425f | Michael Hanselmann | self.assertEqual(ops[1].osparams, osparams) |
446 | c744425f | Michael Hanselmann | |
447 | c744425f | Michael Hanselmann | def testDefaults(self): |
448 | c744425f | Michael Hanselmann | name = "noolee0g"
|
449 | c744425f | Michael Hanselmann | |
450 | c744425f | Michael Hanselmann | ops = self.Parse(name, {"os": "linux1"}) |
451 | c744425f | Michael Hanselmann | self.assertEqual(len(ops), 3) |
452 | c744425f | Michael Hanselmann | self._Check(ops, name)
|
453 | c744425f | Michael Hanselmann | self.assertEqual(ops[1].os_type, "linux1") |
454 | c744425f | Michael Hanselmann | self.assertFalse(ops[1].osparams) |
455 | c744425f | Michael Hanselmann | |
456 | c744425f | Michael Hanselmann | |
457 | 0dbaa9ca | Adeodato Simo | class TestParseRenameGroupRequest(testutils.GanetiTestCase): |
458 | 0dbaa9ca | Adeodato Simo | def setUp(self): |
459 | 0dbaa9ca | Adeodato Simo | testutils.GanetiTestCase.setUp(self)
|
460 | 0dbaa9ca | Adeodato Simo | |
461 | 0dbaa9ca | Adeodato Simo | self.Parse = rlib2._ParseRenameGroupRequest
|
462 | 0dbaa9ca | Adeodato Simo | |
463 | 0dbaa9ca | Adeodato Simo | def test(self): |
464 | 0dbaa9ca | Adeodato Simo | name = "instij0eeph7"
|
465 | 0dbaa9ca | Adeodato Simo | data = { |
466 | 0dbaa9ca | Adeodato Simo | "new_name": "ua0aiyoo", |
467 | 0dbaa9ca | Adeodato Simo | } |
468 | 0dbaa9ca | Adeodato Simo | |
469 | 0dbaa9ca | Adeodato Simo | op = self.Parse(name, data, False) |
470 | 0dbaa9ca | Adeodato Simo | |
471 | a8173e82 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpGroupRename)) |
472 | 12da663a | Michael Hanselmann | self.assertEqual(op.group_name, name)
|
473 | 0dbaa9ca | Adeodato Simo | self.assertEqual(op.new_name, "ua0aiyoo") |
474 | 0dbaa9ca | Adeodato Simo | self.assertFalse(op.dry_run)
|
475 | 0dbaa9ca | Adeodato Simo | |
476 | 0dbaa9ca | Adeodato Simo | def testDryRun(self): |
477 | 0dbaa9ca | Adeodato Simo | name = "instij0eeph7"
|
478 | 0dbaa9ca | Adeodato Simo | data = { |
479 | 0dbaa9ca | Adeodato Simo | "new_name": "ua0aiyoo", |
480 | 0dbaa9ca | Adeodato Simo | } |
481 | 0dbaa9ca | Adeodato Simo | |
482 | 0dbaa9ca | Adeodato Simo | op = self.Parse(name, data, True) |
483 | 0dbaa9ca | Adeodato Simo | |
484 | a8173e82 | Iustin Pop | self.assert_(isinstance(op, opcodes.OpGroupRename)) |
485 | 12da663a | Michael Hanselmann | self.assertEqual(op.group_name, name)
|
486 | 0dbaa9ca | Adeodato Simo | self.assertEqual(op.new_name, "ua0aiyoo") |
487 | 0dbaa9ca | Adeodato Simo | self.assert_(op.dry_run)
|
488 | 0dbaa9ca | Adeodato Simo | |
489 | 0dbaa9ca | Adeodato Simo | |
490 | d1c172de | Michael Hanselmann | class TestParseInstanceReplaceDisksRequest(unittest.TestCase): |
491 | d1c172de | Michael Hanselmann | def setUp(self): |
492 | d1c172de | Michael Hanselmann | self.Parse = rlib2._ParseInstanceReplaceDisksRequest
|
493 | d1c172de | Michael Hanselmann | |
494 | d1c172de | Michael Hanselmann | def test(self): |
495 | d1c172de | Michael Hanselmann | name = "inst22568"
|
496 | d1c172de | Michael Hanselmann | |
497 | d1c172de | Michael Hanselmann | for disks in [range(1, 4), "1,2,3", "1, 2, 3"]: |
498 | d1c172de | Michael Hanselmann | data = { |
499 | d1c172de | Michael Hanselmann | "mode": constants.REPLACE_DISK_SEC,
|
500 | d1c172de | Michael Hanselmann | "disks": disks,
|
501 | d1c172de | Michael Hanselmann | "iallocator": "myalloc", |
502 | d1c172de | Michael Hanselmann | } |
503 | d1c172de | Michael Hanselmann | |
504 | d1c172de | Michael Hanselmann | op = self.Parse(name, data)
|
505 | d1c172de | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpInstanceReplaceDisks)) |
506 | d1c172de | Michael Hanselmann | self.assertEqual(op.mode, constants.REPLACE_DISK_SEC)
|
507 | d1c172de | Michael Hanselmann | self.assertEqual(op.disks, [1, 2, 3]) |
508 | d1c172de | Michael Hanselmann | self.assertEqual(op.iallocator, "myalloc") |
509 | d1c172de | Michael Hanselmann | |
510 | d1c172de | Michael Hanselmann | def testDefaults(self): |
511 | d1c172de | Michael Hanselmann | name = "inst11413"
|
512 | d1c172de | Michael Hanselmann | data = { |
513 | d1c172de | Michael Hanselmann | "mode": constants.REPLACE_DISK_AUTO,
|
514 | d1c172de | Michael Hanselmann | } |
515 | d1c172de | Michael Hanselmann | |
516 | d1c172de | Michael Hanselmann | op = self.Parse(name, data)
|
517 | d1c172de | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpInstanceReplaceDisks)) |
518 | d1c172de | Michael Hanselmann | self.assertEqual(op.mode, constants.REPLACE_DISK_AUTO)
|
519 | d1c172de | Michael Hanselmann | self.assertFalse(hasattr(op, "iallocator")) |
520 | d1c172de | Michael Hanselmann | self.assertFalse(hasattr(op, "disks")) |
521 | d1c172de | Michael Hanselmann | |
522 | d1c172de | Michael Hanselmann | def testWrong(self): |
523 | d1c172de | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, "inst", |
524 | d1c172de | Michael Hanselmann | { "mode": constants.REPLACE_DISK_AUTO,
|
525 | d1c172de | Michael Hanselmann | "disks": "hello world", |
526 | d1c172de | Michael Hanselmann | }) |
527 | d1c172de | Michael Hanselmann | |
528 | d1c172de | Michael Hanselmann | |
529 | df340fae | Michael Hanselmann | class TestParseModifyGroupRequest(unittest.TestCase): |
530 | df340fae | Michael Hanselmann | def setUp(self): |
531 | df340fae | Michael Hanselmann | self.Parse = rlib2._ParseModifyGroupRequest
|
532 | df340fae | Michael Hanselmann | |
533 | df340fae | Michael Hanselmann | def test(self): |
534 | df340fae | Michael Hanselmann | name = "group6002"
|
535 | df340fae | Michael Hanselmann | |
536 | df340fae | Michael Hanselmann | for policy in constants.VALID_ALLOC_POLICIES: |
537 | df340fae | Michael Hanselmann | data = { |
538 | df340fae | Michael Hanselmann | "alloc_policy": policy,
|
539 | df340fae | Michael Hanselmann | } |
540 | df340fae | Michael Hanselmann | |
541 | df340fae | Michael Hanselmann | op = self.Parse(name, data)
|
542 | df340fae | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpGroupSetParams)) |
543 | df340fae | Michael Hanselmann | self.assertEqual(op.group_name, name)
|
544 | df340fae | Michael Hanselmann | self.assertEqual(op.alloc_policy, policy)
|
545 | df340fae | Michael Hanselmann | |
546 | df340fae | Michael Hanselmann | def testUnknownPolicy(self): |
547 | df340fae | Michael Hanselmann | data = { |
548 | df340fae | Michael Hanselmann | "alloc_policy": "_unknown_policy_", |
549 | df340fae | Michael Hanselmann | } |
550 | df340fae | Michael Hanselmann | |
551 | df340fae | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, "name", data) |
552 | df340fae | Michael Hanselmann | |
553 | df340fae | Michael Hanselmann | def testDefaults(self): |
554 | df340fae | Michael Hanselmann | name = "group6679"
|
555 | df340fae | Michael Hanselmann | data = {} |
556 | df340fae | Michael Hanselmann | |
557 | df340fae | Michael Hanselmann | op = self.Parse(name, data)
|
558 | df340fae | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpGroupSetParams)) |
559 | df340fae | Michael Hanselmann | self.assertEqual(op.group_name, name)
|
560 | df340fae | Michael Hanselmann | self.assertFalse(hasattr(op, "alloc_policy")) |
561 | df340fae | Michael Hanselmann | |
562 | df340fae | Michael Hanselmann | |
563 | 527fbde8 | Michael Hanselmann | class TestParseCreateGroupRequest(unittest.TestCase): |
564 | 527fbde8 | Michael Hanselmann | def setUp(self): |
565 | 527fbde8 | Michael Hanselmann | self.Parse = rlib2._ParseCreateGroupRequest
|
566 | 527fbde8 | Michael Hanselmann | |
567 | 527fbde8 | Michael Hanselmann | def test(self): |
568 | 527fbde8 | Michael Hanselmann | name = "group3618"
|
569 | 527fbde8 | Michael Hanselmann | |
570 | 527fbde8 | Michael Hanselmann | for policy in constants.VALID_ALLOC_POLICIES: |
571 | 527fbde8 | Michael Hanselmann | data = { |
572 | 527fbde8 | Michael Hanselmann | "group_name": name,
|
573 | 527fbde8 | Michael Hanselmann | "alloc_policy": policy,
|
574 | 527fbde8 | Michael Hanselmann | } |
575 | 527fbde8 | Michael Hanselmann | |
576 | 527fbde8 | Michael Hanselmann | op = self.Parse(data, False) |
577 | 527fbde8 | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpGroupAdd)) |
578 | 527fbde8 | Michael Hanselmann | self.assertEqual(op.group_name, name)
|
579 | 527fbde8 | Michael Hanselmann | self.assertEqual(op.alloc_policy, policy)
|
580 | 527fbde8 | Michael Hanselmann | self.assertFalse(op.dry_run)
|
581 | 527fbde8 | Michael Hanselmann | |
582 | 527fbde8 | Michael Hanselmann | def testUnknownPolicy(self): |
583 | 527fbde8 | Michael Hanselmann | data = { |
584 | 527fbde8 | Michael Hanselmann | "alloc_policy": "_unknown_policy_", |
585 | 527fbde8 | Michael Hanselmann | } |
586 | 527fbde8 | Michael Hanselmann | |
587 | 527fbde8 | Michael Hanselmann | self.assertRaises(http.HttpBadRequest, self.Parse, "name", data) |
588 | 527fbde8 | Michael Hanselmann | |
589 | 527fbde8 | Michael Hanselmann | def testDefaults(self): |
590 | 527fbde8 | Michael Hanselmann | name = "group15395"
|
591 | 527fbde8 | Michael Hanselmann | data = { |
592 | 527fbde8 | Michael Hanselmann | "group_name": name,
|
593 | 527fbde8 | Michael Hanselmann | } |
594 | 527fbde8 | Michael Hanselmann | |
595 | 527fbde8 | Michael Hanselmann | op = self.Parse(data, True) |
596 | 527fbde8 | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpGroupAdd)) |
597 | 527fbde8 | Michael Hanselmann | self.assertEqual(op.group_name, name)
|
598 | 527fbde8 | Michael Hanselmann | self.assertFalse(hasattr(op, "alloc_policy")) |
599 | 527fbde8 | Michael Hanselmann | self.assertTrue(op.dry_run)
|
600 | 527fbde8 | Michael Hanselmann | |
601 | 527fbde8 | Michael Hanselmann | def testLegacyName(self): |
602 | 527fbde8 | Michael Hanselmann | name = "group29852"
|
603 | 527fbde8 | Michael Hanselmann | data = { |
604 | 527fbde8 | Michael Hanselmann | "name": name,
|
605 | 527fbde8 | Michael Hanselmann | } |
606 | 527fbde8 | Michael Hanselmann | |
607 | 527fbde8 | Michael Hanselmann | op = self.Parse(data, True) |
608 | 527fbde8 | Michael Hanselmann | self.assert_(isinstance(op, opcodes.OpGroupAdd)) |
609 | 527fbde8 | Michael Hanselmann | self.assertEqual(op.group_name, name)
|
610 | 527fbde8 | Michael Hanselmann | |
611 | 527fbde8 | Michael Hanselmann | |
612 | 6395cebb | Michael Hanselmann | if __name__ == '__main__': |
613 | 6395cebb | Michael Hanselmann | testutils.GanetiTestProgram() |