In hopes to not land a PR for #7116, this increases the wait + timeout as described in https://github.com/Chatterino/chatterino2/issues/7116#issuecomment-5015316981. I think the issue is that macOS runners on GitHub Actions are so incredibly slow sometimes that we get these weird timings. And if that's the cause, the overhead (e.g. from switching tasks) should be constant. Then, if we increase the wait and timeout, we also increase the accepted jitter (timeout - wait) from 100ms to 1s. So if the lag we get is at about 150ms, that is now accepted. Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
To run tests, you'll first need to enable the test flag in cmake. You can do this by adding the -DBUILD_TESTS=On flag to your cmake setup call. (e.g. mkdir build && cd build && cmake -DBUILD_TESTS=On ..)
After you've built Chatterino, you can now run the tests with ctest or by manually running the newly created chatterino-test executable
Pre-requisites to running tests
-
Download & run httpbox
We expect this to be listening to port 9051, you can launch it like this:
httpbox --port 9051 -
Download & run twitch-pubsub-server-test
We expect this to be listening to port 9050, you can launch it like this:twitch-pubsub-server-test 127.0.0.1:9050
Alternatively, you can run the docker-compose defined in this file: docker compose up before you run the tests.
Modifying message building
If you make a change that has to do with message building, there's a big chance that some of the snapshot tests will fail. If this happens, you might want to:
- Set the
UPDATE_SNAPSHOTSboolean at the top of the IrcMessageHandler.cpp test file totrue - Re-run the tests (this will update the snapshots to match your new reality)
- Reset
UPDATE_SNAPSHOTStofalseagain - Then run the tests a final time.
Once this is done, you should take a look at the changes made to the snapshot json files to ensure that it looks correct.