Revision 30131294

b/qa/ganeti-qa.py
31 31
import qa_config
32 32
import qa_daemon
33 33
import qa_env
34
import qa_group
34 35
import qa_instance
35 36
import qa_node
36 37
import qa_os
......
221 222
  RunTestIf("node-storage", qa_node.TestNodeStorage)
222 223

  
223 224

  
225
def RunGroupListTests():
226
  """Run tests for listing node groups.
227

  
228
  """
229
  RunTestIf("group-list", qa_group.TestGroupListDefaultFields)
230
  RunTestIf("group-list", qa_group.TestGroupListAllFields)
231

  
232

  
224 233
def RunExportImportTests(instance, pnode, snode):
225 234
  """Tries to export and import the instance.
226 235

  
......
348 357
  RunTestIf("tags", qa_tags.TestClusterTags)
349 358

  
350 359
  RunCommonNodeTests()
360
  RunGroupListTests()
351 361

  
352 362
  pnode = qa_config.AcquireNode(exclude=qa_config.GetMasterNode())
353 363
  try:
......
374 384
    if qa_config.TestEnabled('instance-add-plain-disk'):
375 385
      instance = RunTest(qa_instance.TestInstanceAddWithPlainDisk, pnode)
376 386
      RunCommonInstanceTests(instance)
387
      RunGroupListTests()
377 388
      RunExportImportTests(instance, pnode, None)
378 389
      RunDaemonTests(instance, pnode)
379 390
      RunTest(qa_instance.TestInstanceRemove, instance)
......
391 402
          instance = RunTest(func, pnode, snode)
392 403
          RunTestIf("cluster-verify", qa_cluster.TestClusterVerify)
393 404
          RunCommonInstanceTests(instance)
405
          RunGroupListTests()
394 406
          if qa_config.TestEnabled('instance-convert-disk'):
395 407
            RunTest(qa_instance.TestInstanceShutdown, instance)
396 408
            RunTest(qa_instance.TestInstanceConvertDisk, instance, snode)
b/qa/qa-sample.json
53 53
    "cluster-reserved-lvs": true,
54 54
    "cluster-modify": true,
55 55

  
56
    "group-list": true,
57

  
56 58
    "node-info": true,
57 59
    "node-volumes": true,
58 60
    "node-readd": true,
b/qa/qa_group.py
1
#
2
#
3

  
4
# Copyright (C) 2010 Google Inc.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
# General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
# 02110-1301, USA.
20

  
21

  
22
from qa_utils import AssertCommand
23

  
24

  
25
def TestGroupListDefaultFields():
26
  """gnt-group list"""
27
  AssertCommand(["gnt-group", "list"])
28

  
29

  
30
def TestGroupListAllFields():
31
  """gnt-group list -o FIELDS"""
32
  AssertCommand(["gnt-group", "list", "-o",
33
                 "name,uuid,node_cnt,node_list,pinst_cnt,pinst_list"])
b/qa/qa_rapi.py
94 94
               "mtotal", "mnode", "mfree",
95 95
               "pinst_cnt", "sinst_cnt", "tags")
96 96

  
97
GROUP_FIELDS = frozenset([
98
  "name", "uuid",
99
  "node_cnt", "node_list",
100
  ])
101

  
97 102
JOB_FIELDS = frozenset([
98 103
  "id", "ops", "status", "summary",
99 104
  "opstatus", "opresult", "oplog",
......
167 172
      for entry in NODE_FIELDS:
168 173
        AssertIn(entry, node)
169 174

  
175
  def _VerifyGroups(data):
176
    default_group = {
177
      "name": "default",
178
      "uri": "/2/groups/default",
179
      }
180
    AssertIn(default_group, data)
181

  
182
  def _VerifyGroupsBulk(data):
183
    for group in data:
184
      for field in GROUP_FIELDS:
185
        AssertIn(field, group)
186

  
170 187
  _DoTests([
171 188
    ("/", None, 'GET', None),
172 189
    ("/2/info", _VerifyInfo, 'GET', None),
173 190
    ("/2/tags", None, 'GET', None),
174 191
    ("/2/nodes", _VerifyNodes, 'GET', None),
175 192
    ("/2/nodes?bulk=1", _VerifyNodesBulk, 'GET', None),
193
    ("/2/groups", _VerifyGroups, 'GET', None),
194
    ("/2/groups?bulk=1", _VerifyGroupsBulk, 'GET', None),
176 195
    ("/2/instances", [], 'GET', None),
177 196
    ("/2/instances?bulk=1", [], 'GET', None),
178 197
    ("/2/os", None, 'GET', None),

Also available in: Unified diff