Revision 8572f1fe test/ganeti.query_unittest.py
b/test/ganeti.query_unittest.py | ||
---|---|---|
289 | 289 |
objects.Node(name="node3", drained=False), |
290 | 290 |
] |
291 | 291 |
for live_data in [None, dict.fromkeys([node.name for node in nodes], {})]: |
292 |
nqd = query.NodeQueryData(nodes, live_data, None, None, None, None, None) |
|
292 |
nqd = query.NodeQueryData(nodes, live_data, None, None, None, None, None, |
|
293 |
None) |
|
293 | 294 |
|
294 | 295 |
q = self._Create(["name", "drained"]) |
295 | 296 |
self.assertEqual(q.RequestedData(), set([query.NQ_CONFIG])) |
... | ... | |
315 | 316 |
set([query.NQ_CONFIG, query.NQ_LIVE, query.NQ_INST, |
316 | 317 |
query.NQ_GROUP, query.NQ_OOB])) |
317 | 318 |
|
319 |
cluster = objects.Cluster(cluster_name="testcluster", |
|
320 |
hvparams=constants.HVC_DEFAULTS, |
|
321 |
beparams={ |
|
322 |
constants.PP_DEFAULT: constants.BEC_DEFAULTS, |
|
323 |
}, |
|
324 |
nicparams={ |
|
325 |
constants.PP_DEFAULT: constants.NICC_DEFAULTS, |
|
326 |
}, |
|
327 |
ndparams=constants.NDC_DEFAULTS, |
|
328 |
) |
|
329 |
|
|
318 | 330 |
node_names = ["node%s" % i for i in range(20)] |
319 | 331 |
master_name = node_names[3] |
320 | 332 |
nodes = [ |
... | ... | |
327 | 339 |
drained=False, |
328 | 340 |
vm_capable=False, |
329 | 341 |
master_capable=False, |
342 |
ndparams={}, |
|
330 | 343 |
group="default", |
331 | 344 |
ctime=1290006900, |
332 | 345 |
mtime=1290006913, |
... | ... | |
373 | 386 |
|
374 | 387 |
ng_uuid = "492b4b74-8670-478a-b98d-4c53a76238e6" |
375 | 388 |
groups = { |
376 |
ng_uuid: objects.NodeGroup(name="ng1", uuid=ng_uuid), |
|
389 |
ng_uuid: objects.NodeGroup(name="ng1", uuid=ng_uuid, ndparams={}),
|
|
377 | 390 |
} |
378 | 391 |
|
379 | 392 |
oob_support = dict((name, False) for name in node_names) |
... | ... | |
382 | 395 |
|
383 | 396 |
nqd = query.NodeQueryData(nodes, live_data, master_name, |
384 | 397 |
node_to_primary, node_to_secondary, groups, |
385 |
oob_support) |
|
398 |
oob_support, cluster)
|
|
386 | 399 |
result = q.Query(nqd) |
387 | 400 |
self.assert_(compat.all(len(row) == len(selected) for row in result)) |
388 | 401 |
self.assertEqual([row[field_index["name"]] for row in result], |
... | ... | |
445 | 458 |
live_data = dict.fromkeys([node.name for node in nodes], {}) |
446 | 459 |
|
447 | 460 |
# No data |
448 |
nqd = query.NodeQueryData(None, None, None, None, None, None, None) |
|
461 |
nqd = query.NodeQueryData(None, None, None, None, None, None, None, None)
|
|
449 | 462 |
self.assertEqual(query._GetLiveNodeField("hello", constants.QFT_NUMBER, |
450 | 463 |
nqd, nodes[0]), |
451 | 464 |
(constants.QRFS_NODATA, None)) |
Also available in: Unified diff