Skip to content

Commit 74896cc

Browse files
committed
comments
1 parent 66343f5 commit 74896cc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

irods/test/rule_test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,23 +440,29 @@ def test_rulefile_in_file_like_object_2__336(self):
440440

441441

442442
def test_rule_exec_context(self):
443-
rule_id = -1
444-
if self.sess.server_version == (4, 2, 1):
443+
if self.sess.server_version < (4, 3):
445444
self.skipTest("""RuleExec's "context" attribute not available before 4.3.0""")
445+
446+
rule_id = -1
447+
446448
try:
449+
# Schedule a delayed rule.
447450
n_minutes = 15
448451
random_int = random.randint(1<<30, (1<<31)-1)
449452
r = Rule(
450453
self.sess,
451454
body=f'''delay("<PLUSET>{n_minutes}m</PLUSET>") {{writeLine("serverLog","{random_int}")}}'''
452455
)
453456
r.execute()
457+
458+
# Get the delayed rule's ID, needed for cancellation.
454459
l = list(self.sess.query(RuleExec).filter(Like(RuleExec.name,f'%"{random_int}"%')))
455460
rule_id = l[0][RuleExec.id]
456461

457462
# Assert context exists, is of string type, and is not empty.
458463
self.assertGreater(l[0][RuleExec.context], "")
459464
finally:
465+
# Remove the delayed rule from the queue.
460466
if rule_id >= 0:
461467
r.remove_by_id(rule_id)
462468

0 commit comments

Comments
 (0)