-
Notifications
You must be signed in to change notification settings - Fork 51
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
Change unit test of stratum to use unused ports #457
Comments
@Kais-DkM I think it is inevitable by the structure of |
@jhs7jhs Then what would be the correct operation when the port is already occupied? |
@Kais-DkM Just find another port to open. "using a socket address which is not used now" |
@jhs7jhs It seems we have to choose a range of ports for testing. Do you have any value in mind? |
@Kais-DkM How about the range 19900 ~ 19999? The current test cases are using 19970, 19975, 19990, 19995, 19991. I don't know reason why, but 100 ports should be enough to test, as I think. |
I agree with that. It seems good enough if there's no problem. |
Some unit tests in
stratum
crate opens network socket.e.g.
codechain/stratum/src/lib.rs
Line 455 in 420b63e
While it works and serves its own purpose, it's not a good practice to depend on external environment in unit test.
For example, if socket is already open by other application, the test will fail even if there's nothing wrong with its logic.
We should remove such tests, and find other way to test functionalities in those files.
The text was updated successfully, but these errors were encountered: