Commit bfbef99b authored by Helga Velroyen's avatar Helga Velroyen
Browse files

QA: Make Query tests test for '?' values



When something goes wrong in the Haskell implementation of
queries, the 'gnt-* list' command does not actually fail,
but it just displays '?' as a sign of failure. We so far
do not test for that, which makes errors in the haskell
queries go undetected. This patch fixes that.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 212b66c3
......@@ -514,7 +514,22 @@ def _List(listcmd, fields, names):
utils.ShellQuoteArgs(cmd)).splitlines()
def GenericQueryTest(cmd, fields, namefield="name", test_unknown=True):
def _AssertListNoUnknownValues(listcmd, fields):
"""Assert that the list command does not output unknown values.
"""
master = qa_config.GetMasterNode()
cmd = [listcmd, "list", "--output", ",".join(fields)]
output = GetCommandOutput(master.primary,
utils.ShellQuoteArgs(cmd)).splitlines()
for line in output:
AssertNotIn('?', line)
def GenericQueryTest(cmd, fields, namefield="name", test_unknown=True,
test_values_unknown=True):
"""Runs a number of tests on query commands.
@param cmd: Command name
......@@ -550,6 +565,9 @@ def GenericQueryTest(cmd, fields, namefield="name", test_unknown=True):
AssertCommand([cmd, "list", "this.name.certainly.does.not.exist"],
fail=True)
if test_values_unknown:
_AssertListNoUnknownValues(cmd, fields)
# Check exit code for listing unknown field
AssertEqual(AssertRedirectedCommand([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