-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add test for ssh connection #1908
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
tests/unit/remote/ssh/test_ssh.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably missing something, but are you sure your _client() is indeed using mockssh's client? It looks to me that remote.ssh that you are using is trying to connect to the machine itself and not to the mockssh's server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, by the looks of it, you've probably wanted to use pytest's fixtures here, right? 🙂 If so, please feel free to do so, we are simply in the middle of migrating from unittest to pytest, so we have a legacy unittest tests and we tend to write new tests with pytest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right. Indeed, the port is not 22. Thanks! 🙂
Let's use fixtures for your tests, since it is the most natural approach. Btw, if you are testing SSHConnection itself, let's move your tests to tests/unit/remote/ssh/test_connection.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I will do it ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@efiop I updated the point as your expectation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@efiop BTW, Do you know why the CI failed? And give me some hints about the detailed source of it (I clicked on the Details but no useful info to move forward)?
Updated: Nevermind, I see the log already
|
@ag613915cao Please checkout this guide https://dvc.org/doc/user-guide/contributing . Your tests on travis fail because it your code is not formatted with |
|
Your appveyor test fails: because |
|
@ag613915cao Still not formatted by black. Try running checks manually |
Updated: All the gates are GREEN now :) |
|
@ag613915cao Btw, your PR doesn't fix #1704 . You are adding new unit tests that use mockssh and the ticket is about enabling func tests that we already have(e.g. tests/func/test_data_sync.py) on windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are testing SSHConnection here, so you don't have to(and probably shouldn't) instantiate it through RemoteSSH, since you could instantiate SSHConnection directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the point. I'm new our community and need a little bit of time to fully understand source code base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a good idea to use __name__ for your regular variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup :)
This commit intends to mock SSH server that not depends on OS which the test running on for testing purpose.
Right. the ticket is intended to enable test ssh on windows and setup env on appveyor. I see appveyor is already set up. So, the ticket should be closed? |
|
@ag613915cao Not really. SSH test is not enabled on windows: https://github.com/iterative/dvc/blob/master/tests/func/test_data_cloud.py#L104 . |
I see. So, you want me to solve it in this commit? |
|
@ag613915cao Let's do that in a separate PR 🙂 |
|
@ag613915cao Thank you! 🎉 |
I pushed new one for this point: #1911 |
This commit intends to mock SSH server that not depends on
OS which the test running on for testing purposes.
Related #1704