Skip to content

Commit

Permalink
[irods#98] Add test for missing test_mode configs
Browse files Browse the repository at this point in the history
Adds a test which removes the test_mode entry from the REP configuration
to ensure that things work as normal. Also adds a test which removes the
log_path_prefix configuration while the test_mode is configured to true
to ensure that things work as normal. These values are allowed to be
undefined in a normal audit plugin configuration.
  • Loading branch information
alanking authored and phdavis1027 committed Jun 27, 2022
1 parent 5cbc0a4 commit 29cc409
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packaging/test_audit_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from . import session
from .. import lib
from .. import paths
from ..configuration import IrodsConfig
from .queue_listener import QueueListener
from .test_resource_types import Test_Resource_Unixfilesystem

Expand Down Expand Up @@ -81,6 +83,29 @@ def test_delayed_rule_with_plugin_configured(self):
finally:
os.unlink(rule_file)


def test_missing_test_mode_config__issue_98(self):
with lib.file_backed_up(paths.server_config_path()):
with session.make_session_for_existing_admin() as admin_session:
irods_config = IrodsConfig()
print(irods_config.server_config)
del irods_config.server_config['plugin_configuration']['rule_engines'][1]['plugin_specific_configuration']['test_mode']
print(irods_config.server_config)
irods_config.commit(irods_config.server_config, irods_config.server_config_path, make_backup=True)
admin_session.assert_icommand(['ils'], 'STDOUT', admin_session.home_collection)


def test_missing_log_path_prefix_config__issue_98(self):
with lib.file_backed_up(paths.server_config_path()):
with session.make_session_for_existing_admin() as admin_session:
irods_config = IrodsConfig()
print(irods_config.server_config)
del irods_config.server_config['plugin_configuration']['rule_engines'][1]['plugin_specific_configuration']['log_path_prefix']
print(irods_config.server_config)
irods_config.commit(irods_config.server_config, irods_config.server_config_path, make_backup=True)
admin_session.assert_icommand(['ils'], 'STDOUT', admin_session.home_collection)


class test_resource_unixfilesystem__issue_19(Test_Resource_Unixfilesystem, unittest.TestCase):
def __init__(self, *args, **kwargs):
# Why: Run with this REP configured in order to exercise serialization of types in REPF
Expand Down

0 comments on commit 29cc409

Please sign in to comment.