beyond-all-reason / teiserver

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

[Feature]: Make it easier for devs to test rating of matches #355

Open jauggy opened 3 months ago

jauggy commented 3 months ago

Describe the Feature

Currently it is very hard to test the rating endpoint as it requires multiple players. Ideally we want devs to be able to test the rating functions by themselves. I'm not sure exactly how to do this but I have some findings.

The way that it works is that there is a worker that processes battles that are yet to be processed in the database. We can run this locally as follows:

iex -S mix phx.server
Teiserver.Battle.Tasks.PostMatchProcessTask.perform(nil)

This function will look at teiserver_battle_matches table and then process ones where processed=false. If we can somehow inject fake battles here then we can run the processing and this allows us to test rating better.

Expected Behavior

Have some ability to test rating matches without needing multiple testers involved. See above for one idea.