-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Update apache-airflow-providers-ssh>=4.0.0 dependency
#53100
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
Conversation
|
This means we are missing a unit test in sftp provider to cover this. If we had a test we would have catch this before merging the PR |
apache-airflow-providers-ssh dependency for apache-airflow-providers-sftpapache-airflow-providers-ssh>=4.0.0 dependency
@eladkal, are you referring to a unit-test to cover the instantiation of the |
Attributes are frequently added to hooks around the code base with no similar issues. |
The issue here is that the |
|
@potiuk correct me if I am wrong but we are testing against lower dependencies? |
|
Yeah - I am here with @eladkal -> it does mean we miss some test case that should be showimg the problem |
|
But it's also hard to say why. - what we do in "lowest deps" tests we bring the deps as low as possible for each provider .. so I wonder why it was passing? |
Agreed, it's a bit weird that it is in-fact passing. Let me take a look and see why that might be the case. |
|
Reverted to the previous lowest dependency, all tests pass, even this one (which is explicitly instantiating @patch("paramiko.SSHClient")
@patch("paramiko.ProxyCommand")
@patch("airflow.providers.sftp.hooks.sftp.SFTPHook.get_connection")
def test_sftp_hook_with_proxy_command(self, mock_get_connection, mock_proxy_command, mock_ssh_client):
# Mock the connection to not have a password
mock_connection = MagicMock()
mock_connection.login = "user"
mock_connection.password = None
mock_connection.host = "example.com"
mock_connection.port = 22
mock_connection.extra = None
mock_get_connection.return_value = mock_connection
mock_sftp_client = MagicMock(spec=SFTPClient)
mock_ssh_client.open_sftp.return_value = mock_sftp_client
mock_transport = MagicMock()
mock_ssh_client.return_value.get_transport.return_value = mock_transport
mock_proxy_command.return_value = MagicMock()
host_proxy_cmd = "ncat --proxy-auth proxy_user:**** --proxy proxy_host:port %h %p"
hook = SFTPHook(
remote_host="example.com",
username="user",
host_proxy_cmd=host_proxy_cmd,
)
with hook.get_managed_conn():
mock_proxy_command.assert_called_once_with(host_proxy_cmd)
mock_ssh_client.return_value.connect.assert_called_once_with(
hostname="example.com",
username="user",
timeout=None,
compress=True,
port=22,
sock=mock_proxy_command.return_value,
look_for_keys=True,
banner_timeout=30.0,
auth_timeout=None,
) |
|
Probably I don't understand something here, but why the PR was merged without fixing the test? As it was passing on a previous lowest dependency where it should fail? |
Good call. Likely test was missing to test the error in #53084 - maybe you could add one @ivan-toriya-precis ? That would be awesome. |
As specified in #53084, starting in v5.0.0, the
apache-airflow-providers-sftpis using keyword argument introduced inapache-airflow-providers-sshv4.0.0. Thus, the minimum version ofapache-airflow-providers-sshwas updated to be>=4.0.0.closes: #53084