Skip to content

Commit

Permalink
[irods#5734] Add GenQuery2 test for invalid query string.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn authored and alanking committed Apr 9, 2024
1 parent 8e4958c commit 1b4170d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/irods/test/test_iquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,15 @@ def test_iquery_supports_embedded_single_quotes__issue_5727(self):
query_string = f"select DATA_NAME, COLL_NAME where COLL_NAME = '{self.user.session_collection}' or DATA_NAME = '{escaped}'"
with self.subTest(f'escaped_string={escaped}'):
self.user.assert_icommand(['iquery', query_string], 'STDOUT', [json_string])

def test_iquery_returns_error_on_invalid_query_string__issue_5734(self):
# The following query is missing a closing single quote on the first condition
# in the WHERE clause.
query_string = "select DATA_ID, DATA_REPL_NUM, COLL_NAME, DATA_NAME, DATA_RESC_HIER, DATA_PATH, META_DATA_ATTR_VALUE " + \
"where META_DATA_ATTR_NAME = 'id_foo and META_DATA_ATTR_VALUE in ('260,'3261852','3261856','3261901','3080907','3083125'," + \
"'3083853','3084203','3085046','3091021','3092210','3092313','3093766','3094073','3094078','3095017','3095445','3095522','3097128'," + \
"'3097225','3097311','3097480','3097702','3097750')"
ec, out, err = self.user.assert_icommand_fail(['iquery', query_string], 'STDOUT')
self.assertEqual(ec, 1)
self.assertEqual(len(out), 0)
self.assertEqual(err, 'error: -167000\n') # SYS_LIBRARY_ERROR

0 comments on commit 1b4170d

Please sign in to comment.