Commit 6d1e4845 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Fix QA failures with "gnt-job list"

Jobs have no “name” field.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent f037e9d7
......@@ -30,7 +30,8 @@ import qa_utils
def TestJobList():
"""gnt-job list"""
qa_utils.GenericQueryTest("gnt-job", query.JOB_FIELDS.keys())
qa_utils.GenericQueryTest("gnt-job", query.JOB_FIELDS.keys(),
namefield="id", test_unknown=False)
def TestJobListFields():
......@@ -410,7 +410,7 @@ def _List(listcmd, fields, names):
def GenericQueryTest(cmd, fields):
def GenericQueryTest(cmd, fields, namefield="name", test_unknown=True):
"""Runs a number of tests on query commands.
@param cmd: Command name
......@@ -426,7 +426,7 @@ def GenericQueryTest(cmd, fields):
for testfields in _SelectQueryFields(rnd, fields):
AssertCommand([cmd, "list", "--output", ",".join(testfields)])
namelist_fn = compat.partial(_List, cmd, ["name"])
namelist_fn = compat.partial(_List, cmd, [namefield])
# When no names were requested, the list must be sorted
names = namelist_fn(None)
......@@ -440,8 +440,10 @@ def GenericQueryTest(cmd, fields):
AssertEqual(namelist_fn(randnames), randnames)
# Listing unknown items must fail
AssertCommand([cmd, "list", ""], fail=True)
if test_unknown:
# Listing unknown items must fail
AssertCommand([cmd, "list", ""],
# Check exit code for listing unknown field
AssertEqual(AssertCommand([cmd, "list", "--output=field/does/not/exist"],
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment