Skip to content

Commit

Permalink
[irods#7990] Change test so USER_SOCK_CONNECT_TIMEDOUT is also accepted.
Browse files Browse the repository at this point in the history
  • Loading branch information
FifthPotato authored and alanking committed Nov 7, 2024
1 parent faa790e commit 759a039
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions scripts/irods/test/test_resource_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 759a039

Please sign in to comment.