Bug 38782 - ERM eUsage related tests are failing
Summary: ERM eUsage related tests are failing
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: ERM (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Pedro Amorim
QA Contact: Testopia
URL:
Keywords:
Depends on: 36627
Blocks:
  Show dependency treegraph
 
Reported: 2024-12-24 10:36 UTC by Pedro Amorim
Modified: 2025-01-10 03:36 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes failing ERM usage tests.
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 38782: Mock userenv->{number} (1.05 KB, patch)
2024-12-24 10:42 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38782: Remove concat in background process (1.40 KB, patch)
2024-12-24 10:42 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38782: Apply same fix for CounterFile.t (1.03 KB, patch)
2024-12-24 10:47 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38782: Mock userenv->{number} (1.37 KB, patch)
2024-12-24 10:55 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 38782: Remove concat in background process (1.46 KB, patch)
2024-12-24 10:55 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 38782: Apply same fix for CounterFile.t (1.35 KB, patch)
2024-12-24 10:55 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 38782: Fix erm_custom_reports.t (3.30 KB, patch)
2024-12-24 10:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38782: mock_userenv in API tests (8.39 KB, patch)
2024-12-24 11:15 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38782: mock_userenv in API tests (8.34 KB, patch)
2024-12-24 11:16 UTC, Pedro Amorim
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2024-12-24 10:36:22 UTC

    
Comment 1 Pedro Amorim 2024-12-24 10:42:24 UTC
Created attachment 175922 [details] [review]
Bug 38782: Mock userenv->{number}

prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t
Comment 2 Pedro Amorim 2024-12-24 10:42:27 UTC
Created attachment 175923 [details] [review]
Bug 38782: Remove concat in background process

The ud_provider->{report_type} is only defined on ->harvest_sushi, meaning it'll never be defined here.
We don't need this anyway. The filename should be the filename of the file being manually uploaded. We only need this concat logic for COUNTER files being generated by Koha following a SUSHI harvest, and that works.
This also gets rid of a warning when running the tests
Comment 3 Pedro Amorim 2024-12-24 10:47:16 UTC
Created attachment 175924 [details] [review]
Bug 38782: Apply same fix for CounterFile.t

prove t/db_dependent/Koha/ERM/EUsage/CounterFile.t
Comment 4 Tomás Cohen Arazi (tcohen) 2024-12-24 10:55:33 UTC
Created attachment 175925 [details] [review]
Bug 38782: Mock userenv->{number}

prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: tidy (tcohen)
Comment 5 Tomás Cohen Arazi (tcohen) 2024-12-24 10:55:36 UTC
Created attachment 175926 [details] [review]
Bug 38782: Remove concat in background process

The ud_provider->{report_type} is only defined on ->harvest_sushi, meaning it'll never be defined here.
We don't need this anyway. The filename should be the filename of the file being manually uploaded. We only need this concat logic for COUNTER files being generated by Koha following a SUSHI harvest, and that works.
This also gets rid of a warning when running the tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Tomás Cohen Arazi (tcohen) 2024-12-24 10:55:38 UTC
Created attachment 175927 [details] [review]
Bug 38782: Apply same fix for CounterFile.t

prove t/db_dependent/Koha/ERM/EUsage/CounterFile.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: tidy (tcohen)
Comment 7 Pedro Amorim 2024-12-24 10:58:33 UTC
Created attachment 175928 [details] [review]
Bug 38782: Fix erm_custom_reports.t

DRY superlibrarian declarion to top for all test methods.
Apply same fix from before i.e. mock_userenv

prove t/db_dependent/api/v1/erm_custom_reports.t
Comment 8 Pedro Amorim 2024-12-24 10:59:12 UTC
Thanks Tomas, I was missing a last (I think) test fix. Please double-check my last patch when you have the chance. Thanks!
Comment 9 Tomás Cohen Arazi (tcohen) 2024-12-24 11:09:38 UTC
(In reply to Pedro Amorim from comment #8)
> Thanks Tomas, I was missing a last (I think) test fix. Please double-check
> my last patch when you have the chance. Thanks!

I think it should happen inside a transaction.
Comment 10 Pedro Amorim 2024-12-24 11:15:15 UTC Comment hidden (obsolete)
Comment 11 Pedro Amorim 2024-12-24 11:15:53 UTC
(In reply to Tomás Cohen Arazi (tcohen) from comment #9)
> I think it should happen inside a transaction.

Fair. Patch amended.
Comment 12 Pedro Amorim 2024-12-24 11:16:45 UTC
Created attachment 175930 [details] [review]
Bug 38782: mock_userenv in API tests

Reorder logic slightly for each to only create the counter_file after the mock_userenv has taken place

prove t/db_dependent/api/v1/erm_custom_reports.t
Comment 13 Katrin Fischer 2024-12-27 14:02:12 UTC
Thanks Pedro!
Comment 14 Katrin Fischer 2024-12-27 14:20:26 UTC
Pushed for 25.05!

Well done everyone, thank you!