Closed DeviousNull closed 1 month ago
@geekingfrog : Hmm. I have a suspicion that there's a performance-related factor in why the tests fail for me...
For Teiserver development/testing, I use a VM with an iSCSI-connected disk. Having your database process going out over the network in order to access the actual data-on-disk is, let's say, slightly slow.
It is extremely consistent to reproduce when I use that seed, though, so this PR does appear to improve the robustness of the tests at a minimum.
I get 1 error on master and on this PR.
Teiserver.Logging.Tasks.PersistServerDayTaskTest [test/teiserver/logging/persist_server_day_task_test.exs]
* test perform task (31.1ms) [L#7]
1) test perform task (Teiserver.Logging.Tasks.PersistServerDayTaskTest)
test/teiserver/logging/persist_server_day_task_test.exs:7
** (KeyError) key :date not found in: nil. If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
code: assert log.date == Timex.to_date({2021, 1, 1})
stacktrace:
test/teiserver/logging/persist_server_day_task_test.exs:17: (test)
Same error as above. Weird.
However this PR does make the tests more robust so it's probably good overall.
Currently, several tests will pass/fail depending on whether they run before or after other tests. This happens because some tests create lobbies but do not remove them, while other tests assume that there are no lobbies when they begin.
For all tests which currently create lobbies, this PR:
assert
to each test, to ensure that the lobby was removed.I have used the following command to test this PR:
Using the current master branch without these patches, this command results in:
With these patches, the above command results in: