Bug 35757

Summary: Sushi service and counter registry tests are failing
Product: Koha Reporter: Matt Blenkinsop <matt.blenkinsop>
Component: ERMAssignee: Matt Blenkinsop <matt.blenkinsop>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, jonathan.field, lucas, martin.renvoize, matt.blenkinsop, pedro.amorim
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.02
Circulation function:
Attachments: Bug 35757: Add new fields to api definitions
Bug 35757: Fix unit tests for external counter registry API
Bug 35757: Fix unit tests for external counter registry API
Bug 35757: Add new fields to api definitions
Bug 35757: Fix unit tests for external counter registry API
Bug 35757: Add new fields to api definitions
Bug 35757: Fix unit tests for external counter registry API
Bug 35757: (QA follow-up) Tidy

Description Matt Blenkinsop 2024-01-10 10:12:55 UTC
The tests for the sushi service and counter registry endpoints are failing. Currently they are based on comparing an expected response with an actual response which is not ideal. This bug is to re-write the tests to just check the field names that are being returned by the external API so identify any changes to the API that could affect functionality in Koha.
Comment 1 Matt Blenkinsop 2024-01-10 10:19:36 UTC
Created attachment 160745 [details] [review]
Bug 35757: Add new fields to api definitions

The counter registry API has added a new field to both the counter registry and sushi service endpoints. This patch adds those new fields to the definitions.
Comment 2 Matt Blenkinsop 2024-01-10 10:19:39 UTC
Created attachment 160746 [details] [review]
Bug 35757: Fix unit tests for external counter registry API

This patch updates the unit tests for the external counter registry API used in the Usage Statistics module. The intent of the tests is to identify any changes in the external response that could lead to errors in Koha. To do this, the tests now compare the list of hask keys returned in the response with the current definition in Koha, and identifies any new fields that need to be added to the definition.

Test plan:
prove t/db_dependent/api/v1/erm_counter_registries.t
prove t/db_dependent/api/v1/erm_sushi_services.t
Comment 3 Matt Blenkinsop 2024-01-10 10:22:59 UTC
Created attachment 160747 [details] [review]
Bug 35757: Fix unit tests for external counter registry API

This patch updates the unit tests for the external counter registry API used in the Usage Statistics module. The intent of the tests is to identify any changes in the external response that could lead to errors in Koha. To do this, the tests now compare the list of hash keys returned in the response with the current definition in Koha, and identifies any new fields that need to be added to the definition.

Test plan:
prove t/db_dependent/api/v1/erm_counter_registries.t
prove t/db_dependent/api/v1/erm_sushi_services.t
Comment 4 David Nind 2024-01-10 10:25:19 UTC
Created attachment 160748 [details] [review]
Bug 35757: Add new fields to api definitions

The counter registry API has added a new field to both the counter registry and sushi service endpoints. This patch adds those new fields to the definitions.

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2024-01-10 10:25:22 UTC
Created attachment 160749 [details] [review]
Bug 35757: Fix unit tests for external counter registry API

This patch updates the unit tests for the external counter registry API used in the Usage Statistics module. The intent of the tests is to identify any changes in the external response that could lead to errors in Koha. To do this, the tests now compare the list of hash keys returned in the response with the current definition in Koha, and identifies any new fields that need to be added to the definition.

Test plan:
prove t/db_dependent/api/v1/erm_counter_registries.t
prove t/db_dependent/api/v1/erm_sushi_services.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 Nick Clemens (kidclamp) 2024-01-10 18:10:03 UTC
Created attachment 160779 [details] [review]
Bug 35757: Add new fields to api definitions

The counter registry API has added a new field to both the counter registry and sushi service endpoints. This patch adds those new fields to the definitions.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Nick Clemens (kidclamp) 2024-01-10 18:10:05 UTC
Created attachment 160780 [details] [review]
Bug 35757: Fix unit tests for external counter registry API

This patch updates the unit tests for the external counter registry API used in the Usage Statistics module. The intent of the tests is to identify any changes in the external response that could lead to errors in Koha. To do this, the tests now compare the list of hash keys returned in the response with the current definition in Koha, and identifies any new fields that need to be added to the definition.

Test plan:
prove t/db_dependent/api/v1/erm_counter_registries.t
prove t/db_dependent/api/v1/erm_sushi_services.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 Nick Clemens (kidclamp) 2024-01-10 18:10:07 UTC
Created attachment 160781 [details] [review]
Bug 35757: (QA follow-up) Tidy
Comment 9 Jonathan Druart 2024-01-11 07:37:00 UTC
1. Can this kind of failure be anticipated? Should we watch sushi's repo to catch such changes in advance?

2. Shouldn't you adjust cy.getCounterRegistryProvider (t/cypress/support/e2e.js) as well?
Comment 10 Matt Blenkinsop 2024-01-11 09:34:26 UTC
(In reply to Jonathan Druart from comment #9)
> 1. Can this kind of failure be anticipated? Should we watch sushi's repo to
> catch such changes in advance?

The repo isn't public so we can't watch this. The idea of the test is to watch for changes to the API and alert us to any new fields that have been added.
 
> 2. Shouldn't you adjust cy.getCounterRegistryProvider
> (t/cypress/support/e2e.js) as well?

The cypress test is just a mock for the fields that we actually use so isn't dependent on the API. I can update it but the tests shouldn't fail as a result of this
Comment 11 Katrin Fischer 2024-01-11 11:12:12 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 12 Fridolin Somers 2024-01-15 14:03:05 UTC
Pushed to 23.11.x for 23.11.02
Comment 13 Lucas Gass (lukeg) 2024-01-19 20:58:51 UTC
Not needed in 23.05.x, no backport.