Commit 44c2c52
committed
Wait for fanned-out search jobs in testing API
Commit 55bb078 wired `?wait=true` to
`EnqueueVaccinationsSearchInNHSJob.perform_now`,
but that job uses `perform_bulk` to fan out
per-patient `SearchVaccinationRecordsInNHSJob`s onto the
`immunisations_api_search` Sidekiq queue.
Those run async on workers, so the controller
returned 200 before any patient was actually searched —
defeating the point of the wait flag for end-to-end tests.
Poll the queue after `perform_now` returns and only
respond once it has drained (or after a 5-minute timeout).1 parent 3dfc186 commit 44c2c52
2 files changed
Lines changed: 22 additions & 0 deletions
File tree
- app/controllers/api/testing
- spec/requests/api/testing
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
13 | 32 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
0 commit comments