mirror of
https://github.com/archtechx/tenancy-queue-tester.git
synced 2025-12-12 14:14:05 +00:00
add persistence, sync, and forceRefresh assertions
This commit is contained in:
parent
fd830beaf7
commit
6a047d3686
10 changed files with 562 additions and 29 deletions
37
README.md
37
README.md
|
|
@ -4,12 +4,43 @@ In addition to the tests we can write using testbench, we have this repository w
|
|||
1. Creates a new Laravel application
|
||||
2. Sets up Tenancy
|
||||
3. Creates a sample job
|
||||
4. Asserts that the queue worker is working as expected
|
||||
4. Asserts that the queue worker is working as expected -- running in the correct context and responding to restart signals
|
||||
|
||||
This is mostly due to some past bugs that were hard to catch in our test suite.
|
||||
|
||||
With this repo, we can have a separate CI job validating queue behavior _in a real application_.
|
||||
|
||||
## TODOs
|
||||
## Persistence tests
|
||||
|
||||
- Verify how `queue:restart` works in v4
|
||||
Additionally, we can also test for _queue worker persistence_. This refers to the worker staying in the context of the tenant
|
||||
used in the last job. The benefit of that is significantly better third-party package support (especially in cases where said
|
||||
packages unserialize job payloads on e.g. `JobProcessed`).
|
||||
|
||||
In versions prior to v4:
|
||||
- 3.8.5 handles restarts correctly but is not persistent
|
||||
- 3.8.4 is persistent but doesn't respond to restarts correctly (if the last processed job was in the tenant context)
|
||||
|
||||
In v4, there's `QueueTenancyBootstrapper` that works similarly to 3.8.5 and `PersistentQueueTenancyBootstrapper` that works
|
||||
similarly to 3.8.4.
|
||||
|
||||
For the different setups:
|
||||
- 3.x should have only warns on missing persistence
|
||||
- 3.8.4 fails the restart-related assertions. The alternative config (./alternative_config.sh) makes them pass.
|
||||
- 3.8.4 fails the FORCEREFRESH-related assertions. Either run with FORCEREFRESH=0 or set `QueueTenancyBootstrapper::$forceRefresh = true` in a service provider.
|
||||
- 4.x should only show warns on missing persistence
|
||||
- With the alternative config, it should pass ALL tests without any warnings.
|
||||
|
||||
3.x (3.8.5+) tests:
|
||||
```bash
|
||||
./setup.sh
|
||||
./test.sh
|
||||
```
|
||||
|
||||
4.x tests:
|
||||
```bash
|
||||
./setup.sh
|
||||
./test.sh
|
||||
|
||||
./alternative_config.sh
|
||||
PERSISTENT=1 ./test.sh
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue