Open jauggy opened 3 months ago
Even though I get a bunch of red errors all the tests pass. @geekingfrog is this expected? Do I have some setup wrong?
Out of curiosity, I gave it a go and got a test failure on my machine:
ran
mix test --seed 0 test/teiserver/protocols/spring/spring_auth_test.exs:448
output
Excluding tags: [:test]
Including tags: [location: {"test/teiserver/protocols/spring/spring_auth_test.exs", 448}]
1) test RENAMEACCOUNT (Teiserver.SpringAuthTest)
test/teiserver/protocols/spring/spring_auth_test.exs:448
Assertion with == failed
code: assert accepted == "DENIED Flood protection - Please wait 20 seconds and try again"
left: "DENIED No user found for 'test_user_rename'"
right: "DENIED Flood protection - Please wait 20 seconds and try again"
stacktrace:
test/teiserver/protocols/spring/spring_auth_test.exs:507: (test)
(...snip...)
Finished in 6.2 seconds (0.00s async, 6.2s sync)
17 tests, 1 failure, 16 excluded
So, reading line 507, it expected to hit flood protection, but actually could not find the user 'test_user_rename' , even after I bumped the timer.sleep(3000) (3000 milliseconds, I assume) on line 482
5000 milliseconds (5 seconds) worked, however. Maybe my machine is just slow as dirt?
I'm a novice to Elixir, but instead of just sleeping and hoping the timing works out, is there a flush / sync / fsync command we could set in the test to wait for the user rename step to commit properly before proceeding? (feel free to tell me I'm attacking the test from the wrong angle -- maybe protocol tests shouldn't have internal hooks to check to see if the database succeeded -- but then, perhaps instead we can have this be an in-memory database test so it can complete without having to actually flush to disk?)
oooh yeah, that's a skipped test. Noticed the attribute :needs_attention
, we skip these to at least have a green CI that allow us to catch new bugs.
If you want to observe something external, like a rename, you can poll. I have a utility function like that (nothing to do with tachyon, I just don't know of a better place to put it yet).
I haven't looked too much into that test tbh. If you want to have a go you're welcome, it's a good way to start understanding the current code.
There are many tests that are pretty cursed because there are global caches that are not isolated by tests, and sometimes also the code tested drifted away since for a long time there was no CI.
Yeah, I'll see if I can get the test to behave. Thanks for the utility function, I'll see if I can pull in the function in and get the test working.
I do notice the test is covering multiple things (ability to rename, plus flood-protection tracking a user through renames)... Might mean it would be better for me to split the test so as to focus each test on a single test case.
Describe the Bug
Red errors when I run mix test for spring_auth_test.exs
Reproduce the bug
Screenshots
No response
Additional context