From 759a039e73b93f0904344d72edbefca8b9df739a Mon Sep 17 00:00:00 2001 From: Derek D Date: Tue, 5 Nov 2024 20:25:01 +0000 Subject: [PATCH] [#7990] Change test so USER_SOCK_CONNECT_TIMEDOUT is also accepted. --- scripts/irods/test/test_resource_types.py | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/irods/test/test_resource_types.py b/scripts/irods/test/test_resource_types.py index 15db3ed8a2..cfc353661e 100644 --- a/scripts/irods/test/test_resource_types.py +++ b/scripts/irods/test/test_resource_types.py @@ -786,8 +786,12 @@ def test_detached_mode_host_not_in_host_list__issue_4421(self): lib.make_file(file1, 100) # put small file - self.admin.assert_icommand("iput -R %s %s" % (resource_name, file1), 'STDERR', 'USER_SOCK_CONNECT_ERR') # iput - self.admin.assert_icommand("ils -L %s" % file1, 'STDERR_SINGLELINE', "does not exist") # should not be listed + _, err, ec = self.admin.run_icommand("iput -R %s %s" % (resource_name, file1)) + self.assertNotEqual(ec, 0) + + # Both are okay, since either case is possible when connecting to an invalid host. + # It depends on if the host rejects the connection or ignores it (i.e. a "stealth" port). + self.assertTrue('-347000 USER_SOCK_CONNECT_TIMEDOUT' in err or '-305000 USER_SOCK_CONNECT_ERR' in err) finally: if os.path.exists(file1): os.unlink(file1) @@ -807,8 +811,12 @@ def test_attached_mode_default_setting_invalid_host__issue_4421(self): lib.make_file(file1, 100) # put small file - self.admin.assert_icommand("iput -R %s %s" % (resource_name, file1), 'STDERR', 'USER_SOCK_CONNECT_ERR') # iput - self.admin.assert_icommand("ils -L %s" % file1, 'STDERR_SINGLELINE', "does not exist") # should not be listed + _, err, ec = self.admin.run_icommand("iput -R %s %s" % (resource_name, file1)) + self.assertNotEqual(ec, 0) + + # Both are okay, since either case is possible when connecting to an invalid host. + # It depends on if the host rejects the connection or ignores it (i.e. a "stealth" port). + self.assertTrue('-347000 USER_SOCK_CONNECT_TIMEDOUT' in err or '-305000 USER_SOCK_CONNECT_ERR' in err) finally: if os.path.exists(file1): os.unlink(file1) @@ -831,8 +839,12 @@ def test_attached_mode_explicit_setting_invalid_host__issue_4421(self): lib.make_file(file1, 100) # put small file - self.admin.assert_icommand("iput -R %s %s" % (resource_name, file1), 'STDERR', 'USER_SOCK_CONNECT_ERR') # iput - self.admin.assert_icommand("ils -L %s" % file1, 'STDERR_SINGLELINE', "does not exist") # should not be listed + _, err, ec = self.admin.run_icommand("iput -R %s %s" % (resource_name, file1)) + self.assertNotEqual(ec, 0) + + # Both are okay, since either case is possible when connecting to an invalid host. + # It depends on if the host rejects the connection or ignores it (i.e. a "stealth" port). + self.assertTrue('-347000 USER_SOCK_CONNECT_TIMEDOUT' in err or '-305000 USER_SOCK_CONNECT_ERR' in err) finally: if os.path.exists(file1): os.unlink(file1)