-
Notifications
You must be signed in to change notification settings - Fork 53
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
fix for flaky renameuser test using polling-until-expected-result #493
fix for flaky renameuser test using polling-until-expected-result #493
Conversation
Looks like the error message from the test is
This test failure is not occurring when I run locally, but on the other hand I am getting other errors locally that indicate some sort of admin permissions problem, so possibly my local setup is incomplete.
|
…sult relax RENAMEACCOUNT test since apparently more information is returned from the server now formatted code
0d026bb
to
2f4f253
Compare
Nevermind, I had forgotten to restart the server I was running that the unit-tests were bouncing off of. I'm a little surprised this worked when I had several other tests fail locally, but, in the end, this re-enables a test and makes it not nearly as flaky. |
|
||
# Rename with existng name | ||
_send_raw(socket, "RENAMEACCOUNT #{watcher_user.name}\n") | ||
reply = _recv_raw(socket) | ||
assert reply == "SERVERMSG Username already taken\n" | ||
assert String.starts_with?(reply, "SERVERMSG") | ||
assert String.contains?(reply, "Username already taken") |
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.
This is fine as it is. But you can leverage Elixir's pattern matching for something a little bit more direct:
assert "SERVERMSG" <> rest = _recv_raw(socket)
assert String.contains?(rest, …)
Changes
Potential risks
... I'm actually not sure how long it polls or what the timeout is -- if it never times out the poll would run forever, and thus the test would never finish.
I'm open to critiques or improvements on this PR. I am open to troubleshooting and trying to fix other tests after this if this PR is accepted.