Revision 4b10fb65 qa/qa_rapi.py
b/qa/qa_rapi.py | ||
---|---|---|
337 | 337 |
cli.StdioJobPollReportCb()) |
338 | 338 |
|
339 | 339 |
|
340 |
def TestRapiNodeGroups(): |
|
341 |
"""Test several node group operations using RAPI. |
|
342 |
|
|
343 |
""" |
|
344 |
groups = qa_config.get("groups", {}) |
|
345 |
group1, group2, group3 = groups.get("inexistent-groups", |
|
346 |
["group1", "group2", "group3"])[:3] |
|
347 |
|
|
348 |
# Create a group with no attributes |
|
349 |
body = { |
|
350 |
"name": group1, |
|
351 |
} |
|
352 |
|
|
353 |
(job_id, ) = _DoTests([ |
|
354 |
("/2/groups", _VerifyReturnsJob, "POST", body), |
|
355 |
]) |
|
356 |
|
|
357 |
_WaitForRapiJob(job_id) |
|
358 |
|
|
359 |
# Create a group specifying alloc_policy |
|
360 |
body = { |
|
361 |
"name": group2, |
|
362 |
"alloc_policy": constants.ALLOC_POLICY_UNALLOCABLE, |
|
363 |
} |
|
364 |
|
|
365 |
(job_id, ) = _DoTests([ |
|
366 |
("/2/groups", _VerifyReturnsJob, "POST", body), |
|
367 |
]) |
|
368 |
|
|
369 |
_WaitForRapiJob(job_id) |
|
370 |
|
|
371 |
# Modify alloc_policy |
|
372 |
body = { |
|
373 |
"alloc_policy": constants.ALLOC_POLICY_UNALLOCABLE, |
|
374 |
} |
|
375 |
|
|
376 |
(job_id, ) = _DoTests([ |
|
377 |
("/2/groups/%s/modify" % group1, _VerifyReturnsJob, "PUT", body), |
|
378 |
]) |
|
379 |
|
|
380 |
_WaitForRapiJob(job_id) |
|
381 |
|
|
382 |
# Rename a group |
|
383 |
body = { |
|
384 |
"new_name": group3, |
|
385 |
} |
|
386 |
|
|
387 |
(job_id, ) = _DoTests([ |
|
388 |
("/2/groups/%s/rename" % group2, _VerifyReturnsJob, "PUT", body), |
|
389 |
]) |
|
390 |
|
|
391 |
_WaitForRapiJob(job_id) |
|
392 |
|
|
393 |
# Delete groups |
|
394 |
for group in [group1, group3]: |
|
395 |
(job_id, ) = _DoTests([ |
|
396 |
("/2/groups/%s" % group, _VerifyReturnsJob, "DELETE", None), |
|
397 |
]) |
|
398 |
|
|
399 |
_WaitForRapiJob(job_id) |
|
400 |
|
|
401 |
|
|
340 | 402 |
def TestRapiInstanceAdd(node, use_client): |
341 | 403 |
"""Test adding a new instance via RAPI""" |
342 | 404 |
instance = qa_config.AcquireInstance() |
Also available in: Unified diff