generated from DFE-Digital/govuk-rails-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add remaining GET endpoints to parity check (#1847)
* Optimise the `ResponseComparison` deletion on re-run Deleting the existing parity check results can be slow as they can be very large records in the database. We don't care about callbacks or validation here, so we can optimise the deletion with `delete_all`. * Support checking an individual resource We need to be able to request an individual resource as part of the parity check. The difficulty with this is that we need a valid ID for each lead provider. Instead of specifying these manually, I've opted to allow dynamic substitution by evaluating code from the YAML file. We can now specify an ID attribute in the path with `:id` and a corresponding option in the YAML file that, when evaluated (in the context of the `Client`) should return a valid id for the lead provider. * Add remaining GET endpoints to YAML file Add all the listing and individual GET resource endpoints to the YAML file. * Convert CSV responses to hexdigest The CSV responses are very large and cause issues when trying to insert into Postgres. To be able to include them for now we are converting the response CSV to a hexdigest that can be stored and compared. If we want more details we will have to make the requests manually to inspect the responses. * Stop paginating on first mismatch In order to finish the parity check as soon as possible, we stop paginating responses as soon as we encounter a discrepency. A mismatch in a earlier page is likely to effect later pages anyway, so this is all we will be interested in (and other issues would be surfaced on future runs when its fixed). * Remove CSV endpoints These cause issues with timeouts on the database; I'm not sure why as we hash the large CSV response so it shouldn't cause issues. Remove CSV endpoints; if we want to include them we can add another ticket to make them work. * Persist formatted path to ResponseComparison As the id we grab for the lead provider is random, we need to persist it in the `ResponseComparison` to be able to replicate the request. Add `id` to `request_path` before saving (avoids adding a new attribute to `ResponseComparison`). * Pretty format JSON in diff When we output the JSON diff we want to pretty format it or we end up with a single line which is hard to compare. * Deep sort responses If the response is JSON we deep sort the resulting hash so that we can compare the contents irrespective of order (as the new serializers in NPQ reg may serialize the fields in a different order). * Restrict NPQ participant id to accepted applications * Replace use of eval with safer solution Instead of evaluating the YAML contents directly, we can specify a method in the YAML file and call in the `Client`. This also has the benefit of being able to more easily test the possible `id` options.
- Loading branch information
1 parent
c3425d4
commit 37ca1c6
Showing
9 changed files
with
323 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,66 @@ | ||
get: | ||
"/api/v1/npq-applications": | ||
paginate: true | ||
"/api/v2/npq-applications": | ||
paginate: true | ||
"/api/v3/npq-applications": | ||
paginate: true | ||
|
||
"/api/v1/npq-applications/:id": | ||
id: application_ecf_id | ||
"/api/v2/npq-applications/:id": | ||
id: application_ecf_id | ||
"/api/v3/npq-applications/:id": | ||
id: application_ecf_id | ||
|
||
"/api/v1/participant-declarations": | ||
paginate: true | ||
"/api/v2/participant-declarations": | ||
paginate: true | ||
"/api/v3/participant-declarations": | ||
paginate: true | ||
|
||
"/api/v1/participant-declarations/:id": | ||
id: declaration_ecf_id | ||
"/api/v2/participant-declarations/:id": | ||
id: declaration_ecf_id | ||
"/api/v3/participant-declarations/:id": | ||
id: declaration_ecf_id | ||
|
||
"/api/v1/participants/npq/outcomes": | ||
paginate: true | ||
"/api/v2/participants/npq/outcomes": | ||
paginate: true | ||
"/api/v3/participants/npq/outcomes": | ||
paginate: true | ||
|
||
"/api/v1/participants/npq/:id/outcomes": | ||
id: participant_outcome_ecf_id | ||
"/api/v2/participants/npq/:id/outcomes": | ||
id: participant_outcome_ecf_id | ||
"/api/v3/participants/npq/:id/outcomes": | ||
id: participant_outcome_ecf_id | ||
|
||
"/api/v1/participants/npq": | ||
paginate: true | ||
"/api/v2/participants/npq": | ||
paginate: true | ||
"/api/v3/participants/npq": | ||
paginate: true | ||
|
||
"/api/v1/participants/npq/:id": | ||
id: participant_ecf_id | ||
"/api/v2/participants/npq/:id": | ||
id: participant_ecf_id | ||
"/api/v3/participants/npq/:id": | ||
id: participant_ecf_id | ||
|
||
"/api/v3/statements": | ||
paginate: true | ||
"/api/v3/statements?filter[cohort]=2021": | ||
paginate: true | ||
"/api/v3/statements?filter[updated_since]=2024-01-01T12:00:00Z": | ||
paginate: true | ||
|
||
"/api/v3/statements/:id": | ||
id: statement_ecf_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.