Add tests for queued jobs in Laravel 9 #501
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Adds tests for exception handling in queued jobs in the Laravel 9 fixture
I've used docker's init feature to allow running multiple processes in the same docker container. This simplifies the fixture setup as otherwise we'd need 2 more containers — a database and queue worker
When using the init flag docker will spawn an init process as PID 1, which can then spawn more processes. This lets us run the HTTP server and queue worker in the same database. I've configured the fixture to use an sqlite database as well, to avoid having to run a separate database server
The queue worker is started by a new "I start the laravel queue worker" step, which uses
docker compose exec
to run the actual command in the same container that's running the HTTP server. I've monkey patched this into theMaze::Docker
class, but am intending on contributing it back at some point — the change is done but needs some tests in MR itselfThe same test will be implemented in other fixtures in separate PRs to avoid this being unreviewable