Bug 32648 - Search.t is failing if run after Filter_MARC_ViewPolicy.t
Summary: Search.t is failing if run after Filter_MARC_ViewPolicy.t
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
Depends on: 28373
Blocks: 25551
  Show dependency treegraph
 
Reported: 2023-01-17 14:23 UTC by Jonathan Druart
Modified: 2023-12-28 20:47 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.07


Attachments
Bug 32648: Avoid skipping record or hiding item (3.43 KB, patch)
2023-03-31 10:50 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32648: Avoid skipping record or hiding item (3.49 KB, patch)
2023-03-31 11:07 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 32648: Clear cache in Filter_MARC_ViewPolicy.t (877 bytes, patch)
2023-05-15 15:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32648: Clear cache in Filter_MARC_ViewPolicy.t (924 bytes, patch)
2023-05-16 02:05 UTC, David Nind
Details | Diff | Splinter Review
Bug 32648: Clear cache in Filter_MARC_ViewPolicy.t (989 bytes, patch)
2023-05-16 06:46 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2023-01-17 14:23:41 UTC
koha_1       |     #   Failed test 'Item field returned from default XSLT if pref set'
koha_1       |     #   at t/Search.t line 198.
koha_1       |     # found warning: No item at t/Search.t line 186.
koha_1       |     # expected to find warning: (?^u:Item here)
koha_1       |     # Looks like you failed 1 test of 2.
koha_1       | 
koha_1       | #   Failed test 'searchResults PassItemMarcToXSLT test'
koha_1       | #   at t/Search.t line 207.
koha_1       | # Looks like you failed 1 test of 4.
koha_1       | [11:42:56] t/Search.t 

Koha_Master_My8/1161
Comment 1 Jonathan Druart 2023-03-31 07:29:04 UTC
Koha_Master/2448
Comment 2 Nick Clemens 2023-03-31 10:50:25 UTC
Created attachment 149026 [details] [review]
Bug 32648: Avoid skipping record or hiding item

It seems that depending on other tests, the item could be hidden from the record, or
the entire record hidden because of the way we count hidden items.

I add a mock for the two HIddenItems prefs and hardcode an xml record
to avoid problematic data from test builder
Comment 3 Tomás Cohen Arazi 2023-03-31 11:07:41 UTC
Created attachment 149029 [details] [review]
Bug 32648: Avoid skipping record or hiding item

It seems that depending on other tests, the item could be hidden from the record, or
the entire record hidden because of the way we count hidden items.

I add a mock for the two HIddenItems prefs and hardcode an xml record
to avoid problematic data from test builder

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2023-03-31 11:08:11 UTC
Thanks!
Comment 5 Tomás Cohen Arazi 2023-03-31 11:08:50 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 6 Jonathan Druart 2023-04-11 13:12:15 UTC
Still failing Koha_Master_MDB_Latest/1286
Comment 7 Jacob O'Mara 2023-04-16 20:37:24 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 8 Jonathan Druart 2023-05-12 12:11:04 UTC
Looks like it didn't work

00:19:24 koha_1       |     #   Failed test 'Item field returned from default XSLT if pref set'
00:19:24 koha_1       |     #   at t/Search.t line 239.
00:19:24 koha_1       |     # found warning: No item at t/Search.t line 186.
00:19:24 koha_1       |     # expected to find warning: (?^u:Item here)
00:19:24 koha_1       |     # Looks like you failed 1 test of 2.
00:19:24 koha_1       | 
00:19:24 koha_1       | #   Failed test 'searchResults PassItemMarcToXSLT test'
00:19:24 koha_1       | #   at t/Search.t line 248.
00:19:24 koha_1       | # Looks like you failed 1 test of 4.
Comment 9 Jonathan Druart 2023-05-12 12:11:15 UTC
(In reply to Jonathan Druart from comment #8)
> Looks like it didn't work
> 
> 00:19:24 koha_1       |     #   Failed test 'Item field returned from
> default XSLT if pref set'
> 00:19:24 koha_1       |     #   at t/Search.t line 239.
> 00:19:24 koha_1       |     # found warning: No item at t/Search.t line 186.
> 00:19:24 koha_1       |     # expected to find warning: (?^u:Item here)
> 00:19:24 koha_1       |     # Looks like you failed 1 test of 2.
> 00:19:24 koha_1       | 
> 00:19:24 koha_1       | #   Failed test 'searchResults PassItemMarcToXSLT
> test'
> 00:19:24 koha_1       | #   at t/Search.t line 248.
> 00:19:24 koha_1       | # Looks like you failed 1 test of 4.

Koha_Master_My8/1213
Comment 10 Jonathan Druart 2023-05-12 15:58:15 UTC
I've reused the same order as in https://jenkins.koha-community.org/job/Koha_Master_My8/1213/consoleText
And I managed to make it fails. So it's data related (and note that it's wrongly in t instead of t/db_dependent!)

Will need to investigate later. To recreate run this script: https://pastebin.com/t1qmfJcS
Comment 11 Jonathan Druart 2023-05-15 15:11:34 UTC
Some debugging here, 245$a (and I think all other fields and so 952$*) had visibility=8 and so considered hidden.

flush_memcached made the tests pass.

We are missing a flush in another tests, but this also means that this test does not set properly the data it needs.
Comment 12 Jonathan Druart 2023-05-15 15:17:50 UTC
Created attachment 151199 [details] [review]
Bug 32648: Clear cache in Filter_MARC_ViewPolicy.t

Search.t is failing if run after Filter_MARC_ViewPolicy.t because of a
missing flush
Comment 13 David Nind 2023-05-16 02:05:37 UTC
Created attachment 151239 [details] [review]
Bug 32648: Clear cache in Filter_MARC_ViewPolicy.t

Search.t is failing if run after Filter_MARC_ViewPolicy.t because of a
missing flush

Signed-off-by: David Nind <david@davidnind.com>
Comment 14 David Nind 2023-05-16 02:11:26 UTC
Testing notes (using KTD):

1. The main patch for this bug is already in master.

2. Before applying the additional patch:
   - run prove t/db_dependent/Filter_MARC_ViewPolicy.t
 then prove t/Search.t 
     => t/Search.t tests will fail
  - run prove t/db_dependent/Filter_MARC_ViewPolicy.t
 then flush_memcached and then prove t/Search.t 
     => tests pass

3. Apply the second patch and then run prove t/db_dependent/Filter_MARC_ViewPolicy.t
 then prove t/Search.t
   => tests will now pass without the flush_memcached between running the tests
Comment 15 Martin Renvoize 2023-05-16 06:46:49 UTC
Created attachment 151243 [details] [review]
Bug 32648: Clear cache in Filter_MARC_ViewPolicy.t

Search.t is failing if run after Filter_MARC_ViewPolicy.t because of a
missing flush

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 16 Martin Renvoize 2023-05-16 06:47:38 UTC
Back to PQA to get the follow-up pushed.. all works as desired
Comment 17 Jonathan Druart 2023-05-16 09:28:40 UTC
Follow-up pushed to master for 23.05.
Comment 18 Pedro Amorim 2023-06-07 10:16:35 UTC
Nice work everyone!

Pushed to 22.11.x for next release
Comment 19 Pedro Amorim 2023-06-07 10:18:52 UTC
Follow-up pushed to 22.11.07