Bug 39700 - Fix test case t/db_dependent/Authority/Merge.t broken in 34739
Summary: Fix test case t/db_dependent/Authority/Merge.t broken in 34739
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Chris Cormack
QA Contact: Testopia
URL:
Keywords:
Depends on: 34739
Blocks:
  Show dependency treegraph
 
Reported: 2025-04-22 19:23 UTC by Thomas Klausner
Modified: 2025-04-23 07:43 UTC (History)
0 users

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 39700: Fix test case t/db_dependent/Authority/Merge.t broken in 34739 (2.18 KB, patch)
2025-04-22 19:32 UTC, Thomas Klausner
Details | Diff | Splinter Review
Bug 39700: Fix test case t/db_dependent/Authority/Merge.t broken in 34739 (2.24 KB, patch)
2025-04-22 20:09 UTC, Roman Dolny
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Klausner 2025-04-22 19:23:10 UTC
Bug 34739 adds some new tests to t/db_dependent/Authority/Merge.t, which work when run alone. But when running the whole test suite, some weird fails show up.

This patch fixes that bug in the test suite


The new test case calls AddBiblio. And AddBiblio returns ($biblionumber, $biblioitemnumber). But the test calls it like this: my $biblionumber = AddBiblio;


AddBiblio returns a list, but the calling code only stores a single value, so it get's the last value, i.e. the biblioitemnumber.


Now, when running the test alone, the DB sequences for biblio and biblioitem are in sync and both return the same value so the test works (by accident)


But some tests add biblios with multiple items (or biblios without items), thus the sequences are no longer in sync and when the test tries to load a biblio via a biblioitemid, it finds nothing, which causes the fail


bad: my $biblionumber = AddBiblio( $biblio_record, '', { skip_record_index => 1 } );

ok-ish: my ($biblionumber) = AddBiblio( $biblio_record, '', { skip_record_index => 1 } );
Comment 1 Thomas Klausner 2025-04-22 19:32:56 UTC
Created attachment 181309 [details] [review]
Bug 39700: Fix test case t/db_dependent/Authority/Merge.t broken in 34739

Bug 34739 added some test cases to t/db_dependent/Authority/Merge.t which work when run as a standlone test, but fail when run with some other tests. This patch fixes the test.

Test Plan:

* Start KTD and enter a shell
* Run only the single test:
  prove t/db_dependent/Authority/Merge.t
* You should get "All test successful"
* Now run two tests:
  prove t/db_dependent/Biblio.t t/db_dependent/Authority/Merge.t
* You will get a FAIL:
  t/db_dependent/Authority/Merge.t (Wstat: 256 (exited 1) Tests: 14 Failed: 1)
  Failed test:  13

* Apply the patch

* Again run two tests:
  prove t/db_dependent/Biblio.t t/db_dependent/Authority/Merge.t
* You should get "All test successful"

Sponsored by: HKS3
Comment 2 Roman Dolny 2025-04-22 20:09:51 UTC
Created attachment 181310 [details] [review]
Bug 39700: Fix test case t/db_dependent/Authority/Merge.t broken in 34739

Bug 34739 added some test cases to t/db_dependent/Authority/Merge.t which work when run as a standlone test, but fail when run with some other tests. This patch fixes the test.

Test Plan:

* Start KTD and enter a shell
* Run only the single test:
  prove t/db_dependent/Authority/Merge.t
* You should get "All test successful"
* Now run two tests:
  prove t/db_dependent/Biblio.t t/db_dependent/Authority/Merge.t
* You will get a FAIL:
  t/db_dependent/Authority/Merge.t (Wstat: 256 (exited 1) Tests: 14 Failed: 1)
  Failed test:  13

* Apply the patch

* Again run two tests:
  prove t/db_dependent/Biblio.t t/db_dependent/Authority/Merge.t
* You should get "All test successful"

Sponsored by: HKS3

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Katrin Fischer 2025-04-23 05:00:18 UTC
Great detective work, thanks a lot, Thomas!
Comment 4 Katrin Fischer 2025-04-23 05:12:42 UTC
Picking this out of the queue :)
Comment 5 Katrin Fischer 2025-04-23 07:43:31 UTC
Pushed for 25.05!

Well done everyone, thank you!