Bug 23038

Summary: Expected warnings displayed by tests should be hidden
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: m.de.rooy, tomascohen
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Circulation function:
Bug Depends on: 22049, 22908    
Bug Blocks:    
Attachments: Bug 23038: Hide expected warnings from tests
Bug 23038: Hide expected warnings from tests
Bug 23038: Remove unused stderr vars
Bug 23038: Hide expected warnings from tests
Bug 23038: Remove unused stderr vars

Description Jonathan Druart 2019-06-03 16:40:25 UTC
When tests are ran, there are 2 warnings that are expected and raised by DBI.
As they are expected they must be correctly caught and not displayed.
Comment 1 Jonathan Druart 2019-06-03 16:42:51 UTC
Created attachment 90278 [details] [review]
Bug 23038: Hide expected warnings from tests

When tests are ran, there are 2 warnings that are expected and raised by
DBI.
As they are expected they must be correctly caught and not displayed.

We could have reconnect with PrintError turned off, but then reconnect
with it on.

Test plan:
% prove t/db_dependent/Circulation/MarkIssueReturned.t t/db_dependent/Suggestions.t
Must not display DBI warnings
Comment 2 Mark Tompsett 2019-06-17 15:18:48 UTC
Created attachment 90678 [details] [review]
Bug 23038: Hide expected warnings from tests

When tests are ran, there are 2 warnings that are expected and raised by
DBI.
As they are expected they must be correctly caught and not displayed.

We could have reconnect with PrintError turned off, but then reconnect
with it on.

Test plan:
% prove t/db_dependent/Circulation/MarkIssueReturned.t t/db_dependent/Suggestions.t
Must not display DBI warnings

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 3 Marcel de Rooy 2019-06-21 09:42:50 UTC
t/db_dependent/Circulation/MarkIssueReturned.t .. 2/3
    #   Failed test 'An exception is thrown on bad date'
    #   at t/db_dependent/Circulation/MarkIssueReturned.t line 185.
    # expecting: Koha::Exceptions::Object::BadValue
    # found: DBIx::Class::Exception (DBIx::Class::Storage::DBI::_dbh_execute(): Incorrect datetime value: 'bad_date' for column `koha_master`.`issues`.`returndate` at row 1 at /usr/share/koha/Koha/Object.pm line 155
    # )
    # Looks like you failed 1 test of 3.
t/db_dependent/Circulation/MarkIssueReturned.t .. 3/3
#   Failed test 'Manually pass a return date'
#   at t/db_dependent/Circulation/MarkIssueReturned.t line 191.
# Looks like you failed 1 test of 3.
Comment 4 Tomás Cohen Arazi (tcohen) 2019-08-29 17:38:06 UTC
Why is this failed, Marcel? It looks correct to me.
Comment 5 Marcel de Rooy 2019-08-30 05:29:56 UTC
(In reply to Tomás Cohen Arazi from comment #4)
> Why is this failed, Marcel? It looks correct to me.

Comment3 and lack of response ?
Comment 6 Jonathan Druart 2019-09-01 17:47:18 UTC
All ok for me, could you please retest?

kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/Circulation/MarkIssueReturned.t
t/db_dependent/Circulation/MarkIssueReturned.t .. ok  
All tests successful.
Files=1, Tests=3,  4 wallclock secs ( 0.01 usr  0.01 sys +  3.13 cusr  0.50 csys =  3.65 CPU)
Result: PASS
kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/Suggestions.t
t/db_dependent/Suggestions.t .. ok      
All tests successful.
Files=1, Tests=110,  7 wallclock secs ( 0.05 usr  0.01 sys +  5.26 cusr  1.26 csys =  6.58 CPU)
Result: PASS
Comment 7 Katrin Fischer 2019-09-01 21:08:09 UTC
Hm, I see 2 QA script violations with this patch:

 FAIL	t/db_dependent/Circulation/MarkIssueReturned.t
   FAIL	  critic
		# Variables::ProhibitUnusedVariables: Got 1 violation(s).  


 FAIL	t/db_dependent/Suggestions.t
   FAIL	  critic
		# Variables::ProhibitUnusedVariables: Got 1 violation(s).  

But all tests pass. 

Joubu, could you please take a look at those?
Comment 8 Jonathan Druart 2019-10-14 07:47:51 UTC
Created attachment 94041 [details] [review]
Bug 23038: Remove unused stderr vars
Comment 9 Katrin Fischer 2019-10-14 20:13:51 UTC
Created attachment 94100 [details] [review]
Bug 23038: Hide expected warnings from tests

When tests are ran, there are 2 warnings that are expected and raised by
DBI.
As they are expected they must be correctly caught and not displayed.

We could have reconnect with PrintError turned off, but then reconnect
with it on.

Test plan:
% prove t/db_dependent/Circulation/MarkIssueReturned.t t/db_dependent/Suggestions.t
Must not display DBI warnings

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2019-10-14 20:13:54 UTC
Created attachment 94101 [details] [review]
Bug 23038: Remove unused stderr vars

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Martin Renvoize (ashimema) 2019-10-15 13:16:31 UTC
Nice work!

Pushed to master for 19.11.00