-
Notifications
You must be signed in to change notification settings - Fork 74
Allow RULE_EXEC_CONTEXT column access by GenQuery1 #829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,21 +1,23 @@ | ||||||
| #! /usr/bin/env python | ||||||
| # -*- coding: utf-8 -*- | ||||||
|
|
||||||
| import os | ||||||
| import sys | ||||||
| import random | ||||||
| import time | ||||||
| import textwrap | ||||||
| import unittest | ||||||
| from irods.models import DataObject | ||||||
| from irods.column import Like | ||||||
| from irods.models import DataObject, RuleExec | ||||||
| from irods.exception import ( | ||||||
| FAIL_ACTION_ENCOUNTERED_ERR, | ||||||
| RULE_ENGINE_ERROR, | ||||||
| UnknowniRODSError, | ||||||
| ) | ||||||
| import irods.test.helpers as helpers | ||||||
| from irods.rule import Rule | ||||||
| from io import open as io_open | ||||||
| import io | ||||||
|
|
||||||
|
|
||||||
| RE_Plugins_installed_run_condition_args = ( | ||||||
|
|
@@ -436,7 +438,35 @@ | |||||
| self.assertRegex(lines[0], r"\[INTEGER\]\[5\]") | ||||||
| self.assertRegex(lines[1], r"\[STRING\]\[A String\]") | ||||||
|
|
||||||
|
|
||||||
| def test_rule_exec_context(self): | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing issue number. |
||||||
| if self.sess.server_version < (4, 3): | ||||||
| self.skipTest("""RuleExec's "context" attribute not available before 4.3.0""") | ||||||
|
|
||||||
|
Comment on lines
+443
to
+445
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check isn't necessary since iRODS 4.2 is EOL. Assume the iRODS server is 4.3.0 or later. |
||||||
| rule_id = -1 | ||||||
|
|
||||||
| try: | ||||||
| # Schedule a delayed rule. | ||||||
| n_minutes = 15 | ||||||
| random_int = random.randint(1<<30, (1<<31)-1) | ||||||
|
Check failure on line 451 in irods/test/rule_test.py
|
||||||
| r = Rule( | ||||||
| self.sess, | ||||||
| body=f'''delay("<PLUSET>{n_minutes}m</PLUSET>") {{writeLine("serverLog","{random_int}")}}''' | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider specifying the value to |
||||||
| ) | ||||||
| r.execute() | ||||||
|
|
||||||
| # Get the delayed rule's ID, needed for cancellation. | ||||||
| l = list(self.sess.query(RuleExec).filter(Like(RuleExec.name,f'%"{random_int}"%'))) | ||||||
|
Check failure on line 459 in irods/test/rule_test.py
|
||||||
| rule_id = l[0][RuleExec.id] | ||||||
|
|
||||||
| # Assert context exists, is of string type, and is not empty. | ||||||
| self.assertGreater(l[0][RuleExec.context], "") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also assert that |
||||||
| finally: | ||||||
| # Remove the delayed rule from the queue. | ||||||
| if rule_id >= 0: | ||||||
| r.remove_by_id(rule_id) | ||||||
|
|
||||||
|
|
||||||
| if __name__ == "__main__": | ||||||
| # let the tests find the parent irods lib | ||||||
| sys.path.insert(0, os.path.abspath("../..")) | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use more words to describe what the test is about. For example: