beyond-all-reason / teiserver

Middleware server for online gaming
https://www.beyondallreason.info/
MIT License
61 stars 53 forks source link

fix for flaky renameuser test using polling-until-expected-result #493

Closed NortySpock closed 1 month ago

NortySpock commented 1 month ago

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.

NortySpock commented 1 month ago

Looks like the error message from the test is

Error:      test/teiserver/protocols/spring/spring_auth_test.exs:459
     Assertion with == failed
     code:  assert reply == "SERVERMSG Invalid characters in name (only a-z, A-Z, 0-9, [, ] allowed)\n"
     left:  "SERVERMSG Invalid characters in name (only a-z, A-Z, 0-9, [, ] allowed)\nSAIDPRIVATE Coordinator Invalid characters in name (only a-z, A-Z, 0-9, [, ] allowed)\n"
     right: "SERVERMSG Invalid characters in name (only a-z, A-Z, 0-9, [, ] allowed)\n"
     stacktrace:
       test/teiserver/protocols/spring/spring_auth_test.exs:475: (test)

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.

 69) test update user renders errors when data is invalid (TeiserverWeb.Admin.UserControllerTest)
     test/teiserver_web/controllers/admin/user_controller_test.exs:94
     ** (KeyError) key :management_roles not found in: %{
       user: %Teiserver.Account.User{
         __meta__: #Ecto.Schema.Metadata<:loaded, "account_users">,
         id: 1810,
         name: "Current user",
NortySpock commented 1 month ago

Somehow managing to get (in my local build) in the PR branch than in master, even when I pin the seed and exclude ignored tests...

Since it does not seem I'm making progress on this front, I will likely close this PR and attempt to work on a different issue.

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.