Skip to content
Closed
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions python_rules/test_258.r
Comment thread
trel marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import datetime
import pprint as pp
Comment thread
d-w-moore marked this conversation as resolved.
Outdated
from genquery import Query

class Err(Exception): pass

def main(rule_args, callback, rei):
colls = []
home='/tempZone/home/rods'
now = f'{datetime.datetime.now():%s.%f}'
coll_names_lowercase = ['issue-258-'+str(i) for i in range(10)]

try:
for coll in (coll_names_lowercase + [_.capitalize() for _ in coll_names_lowercase]):
retv = callback.msiCollCreate((coll:=f'{home}/{now}/{coll}'), '1', -1)
if retv['arguments'][2] != 0:
raise Err(f'could not create test collection {coll}')
else:
colls.append(coll)

query = Query(
callback, ["COLL_NAME","COLL_PARENT_NAME"],
f"""COLL_NAME like '%/issue%' and COLL_PARENT_NAME = '{home}/{now}'"""
, case_sensitive=False
, offset=1
)

rows = list(query)
total = query.total_rows()

# Assert that offset=1 produced the correct number of row results.

if len(rows) != len(colls)-1:
callback.writeLine('stderr',f'{rows=}')
raise Err('Incorrect result')

# Assert that total_rows found the correct number of total matching rows.

if total != len(colls):
raise Err('Incorrect total')

except:
return -1
finally:
callback.msiRmColl(f'{home}/{now}','forceFlag=',-1)

INPUT null
OUTPUT ruleExecOut
Loading