Bug 26462

Summary: t/db_dependent/Holds.t tests delete data unnecessarily
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Test SuiteAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: david, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00
Circulation function:
Attachments: Bug 26462: Don't delete existing data for tests
Bug 26462: Don't delete existing data for tests
Bug 26462: Don't delete existing data for tests

Description Nick Clemens (kidclamp) 2020-09-15 10:11:00 UTC
While testing on a larger database I noticed that the CanItemBeReserved / holds_per_day tests were hanging. It appears this is because they delete all holds, issues, items, biblios, and circulation rules.

The tests generate their own itemtype, rules, patrons, and libraries. There is no need to delete the existing data.
Comment 1 Nick Clemens (kidclamp) 2020-09-15 10:19:04 UTC
(In reply to Nick Clemens from comment #0)
> While testing on a larger database I noticed that the CanItemBeReserved /
> holds_per_day tests were hanging. It appears this is because they delete all
> holds, issues, items, biblios, and circulation rules.
> 
> The tests generate their own itemtype, rules, patrons, and libraries. There
> is no need to delete the existing data.

Following tests in the file follow the same pattern
Comment 2 Nick Clemens (kidclamp) 2020-09-15 10:19:40 UTC
Created attachment 110097 [details] [review]
Bug 26462: Don't delete existing data for tests

These tests generate their own items, patrons, and circ rules. Existing
system data will not affect the results of the tests. We do not need
to delete information.

You may be able to notice the difference in speed of tests depending on your system. It should
be faster after applying

To test:
1 - Before applying patch:
    prove -v t/db_dependent/Holds.t
2 - It passes
3 - Apply patch
4 - prove -v t/db_dependent/Holds.t
5 - It passes
Comment 3 David Nind 2020-09-15 12:05:43 UTC
Created attachment 110104 [details] [review]
Bug 26462: Don't delete existing data for tests

These tests generate their own items, patrons, and circ rules. Existing
system data will not affect the results of the tests. We do not need
to delete information.

You may be able to notice the difference in speed of tests depending on your system. It should
be faster after applying

To test:
1 - Before applying patch:
    prove -v t/db_dependent/Holds.t
2 - It passes
3 - Apply patch
4 - prove -v t/db_dependent/Holds.t
5 - It passes

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2020-09-15 12:07:23 UTC
Before patch applied:

  All tests successful.
  Files=1, Tests=67, 19 wallclock secs ( 0.04 usr  0.01 sys + 13.94 cusr  1.32 csys = 15.31 CPU)
  Result: PASS

After patch applied:

  All tests successful.
  Files=1, Tests=67,  9 wallclock secs ( 0.05 usr  0.01 sys +  7.99 cusr  0.67 csys =  8.72 CPU)
  Result: PASS
Comment 5 Katrin Fischer 2020-09-15 19:46:17 UTC
Created attachment 110121 [details] [review]
Bug 26462: Don't delete existing data for tests

These tests generate their own items, patrons, and circ rules. Existing
system data will not affect the results of the tests. We do not need
to delete information.

You may be able to notice the difference in speed of tests depending on your system. It should
be faster after applying

To test:
1 - Before applying patch:
    prove -v t/db_dependent/Holds.t
2 - It passes
3 - Apply patch
4 - prove -v t/db_dependent/Holds.t
5 - It passes

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Jonathan Druart 2020-10-01 09:46:02 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 7 Lucas Gass (lukeg) 2020-10-20 17:31:45 UTC
enhancement will not be backported to 20.05.x