Bug 32979 - Add Test::Exception to Logger.t
Summary: Add Test::Exception to Logger.t
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Marcel de Rooy
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-16 12:42 UTC by Marcel de Rooy
Modified: 2023-12-28 20:43 UTC (History)
5 users (show)

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


Attachments
Bug 32979: Add Test::Exception to Logger.t (1.71 KB, patch)
2023-02-16 12:45 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 32979: Add Test::Exception to Logger.t (1.68 KB, patch)
2023-02-16 12:47 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 32979: Add Test::Exception to Logger.t (1.69 KB, patch)
2023-02-17 13:48 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 32979: Skip test if running as root (1.22 KB, patch)
2023-02-17 13:48 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2023-02-16 12:42:16 UTC
Trivial enhancement
Comment 1 Marcel de Rooy 2023-02-16 12:45:43 UTC Comment hidden (obsolete)
Comment 2 Marcel de Rooy 2023-02-16 12:45:59 UTC
Ready for QA
Comment 3 Marcel de Rooy 2023-02-16 12:47:12 UTC
Created attachment 146728 [details] [review]
Bug 32979: Add Test::Exception to Logger.t

Test plan:
Run t/Logger.t
Note: Run under koha user, not root. Root wont have
the permission failure which is tested.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Kyle M Hall 2023-02-17 11:37:02 UTC
Tests fail on a freshly created koha testing docker:

root@kohadevbox:koha(bug32979-qa)$ prove t/Logger.t
t/Logger.t ..
    #   Failed test 'Logger did not init correctly without permission'
    #   at t/Logger.t line 51.
    # expecting: Regexp ((?^u:Permission denied))
    # found: normal exit
    # Looks like you failed 1 test of 10.
t/Logger.t .. 1/1
#   Failed test 'Test01 -- Simple tests for Koha::Logger'
#   at t/Logger.t line 73.
# Looks like you failed 1 test of 1.
t/Logger.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests

Test Summary Report
-------------------
t/Logger.t (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1, Tests=1,  0 wallclock secs ( 0.01 usr  0.01 sys +  0.17 cusr  0.01 csys =  0.20 CPU)
Result: FAIL
Comment 5 Marcel de Rooy 2023-02-17 13:04:58 UTC
(In reply to Kyle M Hall from comment #4)
> Tests fail on a freshly created koha testing docker:
> 
> root@kohadevbox:koha(bug32979-qa)$ prove t/Logger.t
> t/Logger.t ..
>     #   Failed test 'Logger did not init correctly without permission'
>     #   at t/Logger.t line 51.
>     # expecting: Regexp ((?^u:Permission denied))
>     # found: normal exit
>     # Looks like you failed 1 test of 10.
> t/Logger.t .. 1/1
> #   Failed test 'Test01 -- Simple tests for Koha::Logger'
> #   at t/Logger.t line 73.
> # Looks like you failed 1 test of 1.
> t/Logger.t .. Dubious, test returned 1 (wstat 256, 0x100)
> Failed 1/1 subtests
> 
> Test Summary Report
> -------------------
> t/Logger.t (Wstat: 256 Tests: 1 Failed: 1)
>   Failed test:  1
>   Non-zero exit status: 1
> Files=1, Tests=1,  0 wallclock secs ( 0.01 usr  0.01 sys +  0.17 cusr  0.01
> csys =  0.20 CPU)
> Result: FAIL

root@kohadevbox:koha(bug32979-qa)$ prove t/Logger.t

You should not run this test as ROOT !
Comment 6 Marcel de Rooy 2023-02-17 13:05:21 UTC
See commit message ;)
Comment 7 Kyle M Hall 2023-02-17 13:24:39 UTC
(In reply to Marcel de Rooy from comment #6)
> See commit message ;)

ah!
Comment 8 Kyle M Hall 2023-02-17 13:48:32 UTC
Created attachment 146844 [details] [review]
Bug 32979: Add Test::Exception to Logger.t

Test plan:
Run t/Logger.t
Note: Run under koha user, not root. Root wont have
the permission failure which is tested.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Kyle M Hall 2023-02-17 13:48:51 UTC
Created attachment 146845 [details] [review]
Bug 32979: Skip test if running as root

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Tomás Cohen Arazi 2023-02-20 12:45:04 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 11 Martin Renvoize 2023-02-24 08:16:23 UTC
Many hands makes light work, thankyou everyone!

Pushed to 22.11.x for the next release
Comment 12 Lucas Gass 2023-03-01 14:36:00 UTC
Backported to 22.05.x for upcoming 22.05.11
Comment 13 Arthur Suzuki 2023-03-29 09:12:48 UTC
applied to 21.11 for 21.11.19
Comment 14 wainuiwitikapark 2023-04-27 03:56:23 UTC
Not backported to 21.05.x