Summary: | ILSDI_Services.t is failing randomly | ||
---|---|---|---|
Product: | Koha | Reporter: | Jonathan Druart <jonathan.druart> |
Component: | Test Suite | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | Signed Off --- | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | dcook, lucas |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Bug Depends on: | 40622 | ||
Bug Blocks: | 25551 | ||
Attachments: |
Bug 41012: (bug 40622 follow-up) Clear the MSS cache
Bug 41012: (bug 40622 follow-up) Clear the MSS cache |
Description
Jonathan Druart
2025-10-14 10:23:56 UTC
It's passing locally on U22. I don't understand why the test passes. The marc subfield structure cache is not flushed after we hide the title. Created attachment 187899 [details] [review] Bug 41012: (bug 40622 follow-up) Clear the MSS cache For some reasons t/db_dependent/ILSDI_Services.t fails if run after t/db_dependent/api/v1/biblios.t When we modify the MARC subfield structure from the tests we must flush the cache. Actually I don't understand why the tests are even passing. I have not tracked down why it only fails when run after t/db_dependent/api/v1/biblios.t Test plan: 0. Do not apply this patch 1. prove t/db_dependent/api/v1/biblios.t t/db_dependent/ILSDI_Services.t It fails # Failed test 'Title hidden in output as expected' # at t/db_dependent/ILSDI_Services.t line 874. # got: '1' # expected: '0' 2. Apply this patch, repeat 1. => it's green! (In reply to Jonathan Druart from comment #2) > I don't understand why the test passes. The marc subfield structure cache is > not flushed after we hide the title. That's a good point. In KTD, if I run "memcdump -s memcached:11211", I do see a couple of keys... koha_kohadev::MarcSubfieldStructure- koha_kohadev::MarcSubfieldStructure-BKS I wonder if in a fresh KTD if the cache gets populated on the first run of t/db_dependent/ILSDI_Services.t whereas on the CI server it's already been pre-populated I guess I have an idea on how to test that... (In reply to David Cook from comment #4) > In KTD, if I run "memcdump -s memcached:11211", I do see a couple of keys... > koha_kohadev::MarcSubfieldStructure- > koha_kohadev::MarcSubfieldStructure-BKS > > I wonder if in a fresh KTD if the cache gets populated on the first run of > t/db_dependent/ILSDI_Services.t whereas on the CI server it's already been > pre-populated I guess I have an idea on how to test that... Admittedly memcdump isn't the best tool. I've found it doesn't already report everything. But I just tried to add a MARC record in Default Framework and BKS framework via the webapp to pre-prime the caches... Which gave me these cache keys: koha_kohadev::MarcSubfieldStructure- koha_kohadev::MarcStructure-1-BKS koha_kohadev::MarcStructure-1- After running t/db_dependent/ILSDI_Services.t, I get the following: koha_kohadev::MarcStructure-0- koha_kohadev::MarcStructure-1- koha_kohadev::MarcStructure-1-BKS koha_kohadev::MarcSubfieldStructure- In theory the bibliographic framework used should be the default one... So I don't think your patch will help. And the reason is that you can remove the following lines and the test still passes: - my $framework_f245a = Koha::MarcSubfieldStructures->find( - { frameworkcode => $biblio->frameworkcode, tagfield => "245", tagsubfield => "a" } ); - $framework_f245a->hidden('8'); - $framework_f245a->store(); So there's something else going on here... (In reply to David Cook from comment #6) > So I don't think your patch will help. > > And the reason is that you can remove the following lines and the test still > passes: > > - my $framework_f245a = Koha::MarcSubfieldStructures->find( > - { frameworkcode => $biblio->frameworkcode, tagfield => "245", > tagsubfield => "a" } ); > - $framework_f245a->hidden('8'); > - $framework_f245a->store(); > > So there's something else going on here... Actually, if I remove those lines, and then re-run it, it will fail... I don't care to dig into this one more, so I think I'll just sign off the patch, because in theory it should work. We should probably have more cache clearing in the unit tests really... Created attachment 187900 [details] [review] Bug 41012: (bug 40622 follow-up) Clear the MSS cache For some reasons t/db_dependent/ILSDI_Services.t fails if run after t/db_dependent/api/v1/biblios.t When we modify the MARC subfield structure from the tests we must flush the cache. Actually I don't understand why the tests are even passing. I have not tracked down why it only fails when run after t/db_dependent/api/v1/biblios.t Test plan: 0. Do not apply this patch 1. prove t/db_dependent/api/v1/biblios.t t/db_dependent/ILSDI_Services.t It fails # Failed test 'Title hidden in output as expected' # at t/db_dependent/ILSDI_Services.t line 874. # got: '1' # expected: '0' 2. Apply this patch, repeat 1. => it's green! Signed-off-by: David Cook <dcook@prosentient.com.au> (In reply to David Cook from comment #7) > (In reply to David Cook from comment #6) > > So I don't think your patch will help. > > > > And the reason is that you can remove the following lines and the test still > > passes: > > > > - my $framework_f245a = Koha::MarcSubfieldStructures->find( > > - { frameworkcode => $biblio->frameworkcode, tagfield => "245", > > tagsubfield => "a" } ); > > - $framework_f245a->hidden('8'); > > - $framework_f245a->store(); > > > > So there's something else going on here... > > Actually, if I remove those lines, and then re-run it, it will fail... Sorry I mean... if I remove those lines, clear the cache, and re-run it, it will fail |