Skip to content

Commit

Permalink
squash. More updates to tests for iRODS 5 changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Oct 31, 2024
1 parent 8713dd6 commit 587c13b
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions scripts/irods/test/test_federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,39 +125,39 @@ def test_ils_with_misconfigured_ssl_catches_exceptions__issue_6365(self):
test_session = self.user_sessions[0]
remote_home_collection = test_session.remote_home_collection(test.settings.FEDERATION.REMOTE_ZONE)
test_session.assert_icommand(['ils', remote_home_collection], 'STDOUT_SINGLELINE', remote_home_collection)
try:
with temporary_core_file() as core:
# Disable SSL communications in the local server. This should break communications with the remote zone,
# which is supposed to be configured for SSL communications.
core.add_rule('acPreConnect(*OUT) { *OUT = "CS_NEG_REFUSE"; }')
IrodsController().reload_configuration()

# Disable SSL communications in the service account client environment so that it can communicate with
# the local server, which has just disabled SSL communications.
env_update = {'irods_client_server_policy': 'CS_NEG_REFUSE'}
service_account_env_file = os.path.join(paths.irods_directory(), '.irods', "irods_environment.json")
with lib.file_backed_up(service_account_env_file):
lib.update_json_file_from_dict(service_account_env_file, env_update)

# Disable SSL communications in the test session client environment so that it can communicate with
# the local server, which has just disabled SSL communications.
client_env_file = os.path.join(test_session.local_session_dir, "irods_environment.json")
with lib.file_backed_up(client_env_file):
lib.update_json_file_from_dict(client_env_file, env_update)

# Make sure communications with the local zone are in working order...
_, pwd, _ = test_session.assert_icommand(['ipwd'], 'STDOUT', test_session.zone_name)
test_session.assert_icommand(['ils'], 'STDOUT_SINGLELINE', pwd.strip())

# ils in the remote zone should fail due to the misconfigured SSL settings, but not explode.
out, err, rc = test_session.run_icommand(['ils', remote_home_collection])
self.assertNotEqual(0, rc)
self.assertEqual(0, len(out))
self.assertIn('iRODS filesystem error occurred', err)
self.assertNotIn('terminating with uncaught exception', err)

finally:
IrodsController().reload_configuration()
try:
with temporary_core_file() as core:
# Disable SSL communications in the local server. This should break communications with the remote zone,
# which is supposed to be configured for SSL communications.
core.add_rule('acPreConnect(*OUT) { *OUT = "CS_NEG_REFUSE"; }')
IrodsController().reload_configuration()
# Disable SSL communications in the service account client environment so that it can communicate with
# the local server, which has just disabled SSL communications.
env_update = {'irods_client_server_policy': 'CS_NEG_REFUSE'}
service_account_env_file = os.path.join(paths.irods_directory(), '.irods', "irods_environment.json")
with lib.file_backed_up(service_account_env_file):
lib.update_json_file_from_dict(service_account_env_file, env_update)
# Disable SSL communications in the test session client environment so that it can communicate with
# the local server, which has just disabled SSL communications.
client_env_file = os.path.join(test_session.local_session_dir, "irods_environment.json")
with lib.file_backed_up(client_env_file):
lib.update_json_file_from_dict(client_env_file, env_update)
# Make sure communications with the local zone are in working order...
_, pwd, _ = test_session.assert_icommand(['ipwd'], 'STDOUT', test_session.zone_name)
test_session.assert_icommand(['ils'], 'STDOUT_SINGLELINE', pwd.strip())
# ils in the remote zone should fail due to the misconfigured SSL settings, but not explode.
out, err, rc = test_session.run_icommand(['ils', remote_home_collection])
self.assertNotEqual(0, rc)
self.assertEqual(0, len(out))
self.assertIn('iRODS filesystem error occurred', err)
self.assertNotIn('terminating with uncaught exception', err)
finally:
IrodsController().reload_configuration()

def test_ils_subcolls(self):
# pick session(s) for the test
Expand Down Expand Up @@ -1648,7 +1648,7 @@ def test_peps_for_parallel_mode_transfers__issue_5017(self):

with temporary_core_file() as core:
core.add_rule(put_peps)
IrodsController().reload_configuration()
IrodsController().reload_configuration()

# peps to check for the first, successful put
peps = ['data-obj-put-pre', 'data-obj-put-post', 'data-obj-put-finally']
Expand Down Expand Up @@ -1691,7 +1691,7 @@ def test_peps_for_parallel_mode_transfers__issue_5017(self):
test_session.run_icommand(['irm', '-f', logical_path])
self.admin.assert_icommand(['iadmin', 'rum'])

IrodsController().reload_configuration()
IrodsController().reload_configuration()

class Test_Delay_Rule_Removal(SessionsMixin, unittest.TestCase):

Expand Down

0 comments on commit 587c13b

Please sign in to comment.