| Summary: | ILSDI_Services.t is failing randomly | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Jonathan Druart <jonathan.druart> |
| Component: | Test Suite | Assignee: | Jonathan Druart <jonathan.druart> |
| Status: | Pushed to oldstable --- | QA Contact: | Nick Clemens (kidclamp) <nick> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | dcook, fridolin.somers, lucas |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: |
25.11.00,25.05.05,24.11.11
|
|
| 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 Bug 41012: (bug 40622 follow-up) Clear the MSS cache |
||
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 Created attachment 188028 [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> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Nice work everyone! Pushed to main for 25.11 Nice work everyone! Pushed to 25.05.x Pushed to 24.11.x for 24.11.11 |
Koha_Main_U22/2183 18:58:19 koha-1 | # Failed test 'Title hidden in output as expected' 18:58:19 koha-1 | # at t/db_dependent/ILSDI_Services.t line 874. 18:58:19 koha-1 | # got: '1' 18:58:19 koha-1 | # expected: '0' 18:58:19 koha-1 | # Looks like you failed 1 test of 11. 18:58:19 koha-1 | 18:58:19 koha-1 | # Failed test 'GetRecords' 18:58:19 koha-1 | # at t/db_dependent/ILSDI_Services.t line 923. 866 my $cgi = CGI->new; 867 $cgi->param( service => 'GetRecords' ); 868 $cgi->param( id => $item->biblionumber ); 869 870 my $reply = C4::ILSDI::Services::GetRecords($cgi); 871 872 my $opac_marcxml = $reply->{record}->[0]->{marcxml}; 873 my @title_matches = ( $opac_marcxml =~ m/This is an awesome title/g ); 874 is( scalar @title_matches, 0, 'Title hidden in output as expected' );