Bug 35757 - Sushi service and counter registry tests are failing
Summary: Sushi service and counter registry tests are failing
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: ERM (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Matt Blenkinsop
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-10 10:12 UTC by Matt Blenkinsop
Modified: 2024-01-19 20:58 UTC (History)
7 users (show)

See Also:
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


Attachments
Bug 35757: Add new fields to api definitions (1.50 KB, patch)
2024-01-10 10:19 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 35757: Fix unit tests for external counter registry API (10.67 KB, patch)
2024-01-10 10:19 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 35757: Fix unit tests for external counter registry API (10.67 KB, patch)
2024-01-10 10:22 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 35757: Add new fields to api definitions (1.53 KB, patch)
2024-01-10 10:25 UTC, David Nind
Details | Diff | Splinter Review
Bug 35757: Fix unit tests for external counter registry API (10.70 KB, patch)
2024-01-10 10:25 UTC, David Nind
Details | Diff | Splinter Review
Bug 35757: Add new fields to api definitions (1.53 KB, patch)
2024-01-10 18:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35757: Fix unit tests for external counter registry API (10.70 KB, patch)
2024-01-10 18:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35757: (QA follow-up) Tidy (2.36 KB, patch)
2024-01-10 18:10 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 2024-01-19 20:58:51 UTC
Not needed in 23.05.x, no backport.