Bug 20169 - Two tests are failing with DBD::mysql 4.041
Summary: Two tests are failing with DBD::mysql 4.041
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-09 17:26 UTC by Julian Maurice
Modified: 2020-11-30 21:44 UTC (History)
2 users (show)

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


Attachments
Bug 20169: Fix two tests when DBD::mysql is 4.041 (2.65 KB, patch)
2018-02-09 17:32 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 20169: Fix two tests when DBD::mysql is 4.041 (2.69 KB, patch)
2018-02-14 04:15 UTC, Mark Tompsett
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2018-02-09 17:26:46 UTC
Two tests are failing with DBD::mysql 4.041

prove t/db_dependent/Accounts.t t/db_dependent/Bookseller.t

t/db_dependent/Accounts.t .... 17/23
    #   Failed test 'Correct amount logged to statistics'
    #   at t/db_dependent/Accounts.t line 398.
    #          got: '100'
    #     expected: '100.0000'
    # Looks like you failed 1 test of 8.
t/db_dependent/Accounts.t .... 20/23
#   Failed test 'More Koha::Account::pay tests'
#   at t/db_dependent/Accounts.t line 400.

    #   Failed test 'Correct amount logged to statistics'
    #   at t/db_dependent/Accounts.t line 452.
    #          got: '60'
    #     expected: '60.0000'
    # Looks like you failed 1 test of 8.
t/db_dependent/Accounts.t .... 21/23
#   Failed test 'Even more Koha::Account::pay tests'
#   at t/db_dependent/Accounts.t line 454.
t/db_dependent/Accounts.t .... 23/23 # Looks like you failed 2 tests of 23.
t/db_dependent/Accounts.t .... Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/23 subtests
t/db_dependent/Bookseller.t .. 2/86
#   Failed test 'Koha::Acquisition::Booksellers->search returns the right informations about supplier Name2'
#   at t/db_dependent/Bookseller.t line 120.
#     Structures begin differing at:
#          $got->{discount} = '2'
#     $expected->{discount} = '2.0000'

#   Failed test 'Returns right fields of Supplier1 and Supplier2'
#   at t/db_dependent/Bookseller.t line 133.
#     Structures begin differing at:
#          $got->[0]{discount} = '2'
#     $expected->[0]{discount} = '2.0000'

#   Failed test 'Get Supplier1 (find a bookseller by id)'
#   at t/db_dependent/Bookseller.t line 152.
#     Structures begin differing at:
#          $got->{discount} = '1'
#     $expected->{discount} = '1.0000'
# Looks like you failed 3 tests of 86.
t/db_dependent/Bookseller.t .. Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/86 subtests

Test Summary Report
-------------------
t/db_dependent/Accounts.t  (Wstat: 512 Tests: 23 Failed: 2)
  Failed tests:  20-21
  Non-zero exit status: 2
t/db_dependent/Bookseller.t (Wstat: 768 Tests: 86 Failed: 3)
  Failed tests:  9, 11, 15
  Non-zero exit status: 3
Files=2, Tests=109, 12 wallclock secs ( 0.05 usr  0.01 sys +  4.63 cusr  0.75 csys =  5.44 CPU)
Result: FAIL


Tests pass with DBD::mysql 4.028
Comment 1 Julian Maurice 2018-02-09 17:32:35 UTC
Created attachment 71388 [details] [review]
Bug 20169: Fix two tests when DBD::mysql is 4.041

Tests pass with DBD::mysql 4.028, but not with 4.041. I'm not sure which
exact version makes those tests to fail.

The problem is that with newer versions of DBD::mysql, 'float' columns
get converted to numbers instead of string, thus the comparison fail.

This patch converts the expected values to numbers so the
comparison should succeed with both versions of DBD::mysql

Test plan:
1. Install DBD::mysql 4.041 or newer
2. prove t/db_dependent/Accounts.t t/db_dependent/Bookseller.t
Comment 2 Mark Tompsett 2018-02-14 04:15:24 UTC
Created attachment 71595 [details] [review]
Bug 20169: Fix two tests when DBD::mysql is 4.041

Tests pass with DBD::mysql 4.028, but not with 4.041. I'm not sure which
exact version makes those tests to fail.

The problem is that with newer versions of DBD::mysql, 'float' columns
get converted to numbers instead of string, thus the comparison fail.

This patch converts the expected values to numbers so the
comparison should succeed with both versions of DBD::mysql

Test plan:
1. Install DBD::mysql 4.041 or newer
2. prove t/db_dependent/Accounts.t t/db_dependent/Bookseller.t

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 3 Nick Clemens 2018-02-16 15:33:01 UTC
So does this raise the required version? Updated tests fail for DBD::mysql 4.028
Comment 4 Julian Maurice 2018-02-16 15:37:34 UTC
(In reply to Nick Clemens from comment #3)
> So does this raise the required version? Updated tests fail for DBD::mysql
> 4.028

No tests should pass with 4.028 too.
What is the output of tests ?
Comment 5 Nick Clemens 2018-02-16 16:43:10 UTC
not ok 9 - Koha::Acquisition::Booksellers->search returns the right informations about supplier Name2
#   Failed test 'Koha::Acquisition::Booksellers->search returns the right informations about supplier Name2'
#   at t/db_dependent/Bookseller.t line 121.
#     Structures begin differing at:
#          $got->{discount} = '2.0000'
#     $expected->{discount} = '2'
ok 10 - Get  Supplier1 and Supplier2
not ok 11 - Returns right fields of Supplier1 and Supplier2
#   Failed test 'Returns right fields of Supplier1 and Supplier2'
#   at t/db_dependent/Bookseller.t line 134.
#     Structures begin differing at:
#          $got->[0]{discount} = '2.0000'
#     $expected->[0]{discount} = '2'
ok 12 - Supplier1 has 0 basket
ok 13 - Supplier1 has 2 baskets
ok 14 - find returns undef if no id given
not ok 15 - Get Supplier1 (find a bookseller by id)
#   Failed test 'Get Supplier1 (find a bookseller by id)'
#   at t/db_dependent/Bookseller.t line 153.
#     Structures begin differing at:
#          $got->{discount} = '1.0000'
#     $expected->{discount} = '1'
Comment 6 Katrin Fischer 2018-02-18 11:12:10 UTC
Marking Failed QA for now (comment#5)

Tested with kohadevbox and 4.028 Bookseller.t fails for me too:

kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/Bookseller.t 
t/db_dependent/Bookseller.t .. 1/86 
#   Failed test 'Koha::Acquisition::Booksellers->search returns the right informations about supplier Name2'
#   at t/db_dependent/Bookseller.t line 121.
#     Structures begin differing at:
#          $got->{discount} = '2.0000'
#     $expected->{discount} = '2'

#   Failed test 'Returns right fields of Supplier1 and Supplier2'
#   at t/db_dependent/Bookseller.t line 134.
#     Structures begin differing at:
#          $got->[0]{discount} = '2.0000'
#     $expected->[0]{discount} = '2'

#   Failed test 'Get Supplier1 (find a bookseller by id)'
#   at t/db_dependent/Bookseller.t line 153.
#     Structures begin differing at:
#          $got->{discount} = '1.0000'
#     $expected->{discount} = '1'
# Looks like you failed 3 tests of 86.
t/db_dependent/Bookseller.t .. Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/86 subtests 

Test Summary Report
-------------------
t/db_dependent/Bookseller.t (Wstat: 768 Tests: 86 Failed: 3)
  Failed tests:  9, 11, 15
  Non-zero exit status: 3
Comment 7 Julian Maurice 2020-04-10 08:08:24 UTC
Fixed by bug 24408 and bug 20906