Bug 24509 - API related tests failing on MySQL8
Summary: API related tests failing on MySQL8
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 23996
  Show dependency treegraph
 
Reported: 2020-01-24 10:35 UTC by Jonathan Druart
Modified: 2020-11-30 21:45 UTC (History)
3 users (show)

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


Attachments
Bug 24509: Fix tests failing on MySQL8 (4.28 KB, patch)
2020-01-24 12:26 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 24509: Fix API relared tests failing on MySQL8 (4.36 KB, patch)
2020-01-24 12:51 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2020-01-24 10:35:57 UTC
On Koha_Master_D9_My8:

koha_1       |     #   Failed test at t/db_dependent/api/v1/acquisitions_orders.t line 215.
koha_1       |     # found warning: DBD::mysql::st execute failed: Duplicate entry '11' for key 'aqorders.PRIMARY' [for Statement "INSERT INTO `aqorders` ( `basketno`, `biblionumber`, `budget_id`, `cancellationreason`, `claimed_date`, `claims_count`, `created_by`, `currency`, `datecancellationprinted`, `datereceived`, `discount`, `ecost`, `ecost_tax_excluded`, `ecost_tax_included`, `entrydate`, `freight`, `invoiceid`, `listprice`, `order_internalnote`, `order_vendornote`, `ordernumber`, `orderstatus`, `parent_ordernumber`, `quantity`, `quantityreceived`, `replacementprice`, `rrp`, `rrp_tax_excluded`, `rrp_tax_included`, `sort1`, `sort1_authcat`, `sort2`, `sort2_authcat`, `subscriptionid`, `tax_rate_on_ordering`, `tax_rate_on_receiving`, `tax_value_on_ordering`, `tax_value_on_receiving`, `timestamp`, `uncertainprice`, `unitprice`, `unitprice_tax_excluded`, `unitprice_tax_included`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0=15, 1=657, 2=18, 3="r6hKv9u", 4='2020-01-24T00:00:00', 5=1813539654, 6=2000000013, 7="c63kUgJEj3", 8='2020-01-24T09:48:48', 9='2020-01-24T00:00:00', 10=25.27, 11=5.80966e+09, 12=9.2869e+21, 13=7.8939e+21, 14='2020-01-24T00:00:00', 15=1.13533e+21, 16=4, 17=1.65401e+21, 18="This is a dummy note for testing", 19="P5I73Xh8ag", 20=11, 21="new", 22=1344446286, 23=1, 24=0, 25=10, 26=1.81972e+10, 27=9.3789e+21, 28=1.13196e+21, 29="iNIBKvZ01RxmNlvnOJ9Mjzo5D4lFg3O4hKs7bNpK0tNtYe2w2egEUo7_J", 30="oViH6QZfg", 31="j4IqwY2bOIKop0IadGiNTxFBOqTca_w1TtOw9T0A6usBvHRkUHVQLFOx27_t7MbIIk1i", 32="AcJaKIkhar", 33=8, 34=48.3, 35=79.15, 36=5.94319e+21, 37=8.43555e+21, 38='2020-01-24T09:48:46', 39=0, 40=10, 41=4.29247e+21, 42=6.66896e+21] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.
koha_1       |     # expected to find warning: (?^u:^DBD::mysql::st execute failed: Duplicate entry '(.*)' for key 'PRIMARY')
koha_1       |     # Looks like you failed 2 tests of 17.
koha_1       | 
koha_1       | #   Failed test 'add() tests'
koha_1       | #   at t/db_dependent/api/v1/acquisitions_orders.t line 218.



koha_1       |     #   Failed test 'exact match for JSON Pointer "/conflict"'
koha_1       |     #   at t/db_dependent/api/v1/libraries.t line 199.
koha_1       |     #          got: 'branches.PRIMARY'
koha_1       |     #     expected: 'PRIMARY'
koha_1       | 
koha_1       |     #   Failed test at t/db_dependent/api/v1/libraries.t line 203.
koha_1       |     # found warning: DBD::mysql::st execute failed: Duplicate entry 'qjCU_semRj' for key 'branches.PRIMARY' [for Statement "INSERT INTO `branches` ( `branchaddress1`, `branchaddress2`, `branchaddress3`, `branchcity`, `branchcode`, `branchcountry`, `branchemail`, `branchfax`, `branchip`, `branchname`, `branchnotes`, `branchphone`, `branchreplyto`, `branchreturnpath`, `branchstate`, `branchurl`, `branchzip`, `geolocation`, `marcorgcode`, `opac_info`, `pickup_location`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="jn6JSVVD3", 1="nfzCX9m7p", 2="TnmmeQT", 3="jY4ossWU1i", 4="qjCU_semRj", 5="cefvfFrOy2", 6="CZhVkmb", 7="AIlePzZSy", 8="Gw8tzR9ZOZ_kfD", 9="Z3s2gIPGW2", 10="HoVbnAW0Y", 11="H7hUHN", 12="QRwTVe0saq", 13="ySgMvLeX", 14="LuUohqY", 15="zXY2PO", 16="A5fbE0k5VgCVrnfjXxL", 17="y_cg0kJTm0hZHuoiGPbLtuY8iolmUcw78vJz_K6Ep7yoBJ93JP7zZp4aNGW0SbOBqQan44GNBBQFlHee4u3AgUTQQ8RMi52NGrS9j2ZCyB_9_btunsWQy9Me1DMOmP9l6t2m9H60DXWJ0b9ulYoIR4viWLakcRBGIG8FuZgshd_4REkRMs4IRZLmE4rS6ktXsbbc5E3uwd7tZEo3FcPagvfFVKbnZfA1n", 18="sV8SwEd5MI2VP", 19="NUFih1L", 20=1] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.
koha_1       |     # expected to find warning: (?^u:^DBD::mysql::st execute failed: Duplicate entry '(.*)' for key 'PRIMARY')
koha_1       |     # Looks like you failed 2 tests of 17.
koha_1       | 
koha_1       | #   Failed test 'add() tests'
koha_1       | #   at t/db_dependent/api/v1/libraries.t line 206.



koha_1       |     #   Failed test 'Exception field is correct'
koha_1       |     #   at t/db_dependent/Koha/Object.t line 615.
koha_1       |     #          got: 'api_keys.secret'
koha_1       |     #     expected: 'secret'
koha_1       |     # Looks like you failed 1 test of 16.
koha_1       | 
koha_1       | #   Failed test 'store() tests'
koha_1       | #   at t/db_dependent/Koha/Object.t line 688.
koha_1       | # Looks like you failed 1 test of 17.
koha_1       | [10:11:10] t/db_dependent/Koha/Object.t ............................................ 


koha_1       | #   Failed test 'add() tests'
koha_1       | #   at t/db_dependent/api/v1/patrons.t line 215.
koha_1       | 
koha_1       |         #   Failed test 'exact match for JSON Pointer "/conflict"'
koha_1       |         #   at t/db_dependent/api/v1/patrons.t line 311.
koha_1       |         #          got: 'borrowers.cardnumber'
koha_1       |         #     expected: 'cardnumber'
Comment 1 Tomás Cohen Arazi (tcohen) 2020-01-24 12:26:45 UTC
Created attachment 97875 [details] [review]
Bug 24509: Fix tests failing on MySQL8

This patch makes a trivial change to the tests so they catch the way
MySQL 8 reports the duplicate key message. The difference on the API
error message is irrelevant and so it is ok to just make the tests try
both MySQL 8 output and the rest of the supported engines.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t \
           t/db_dependent/api/v1/libraries.t \
           t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail due to warning and conflict message differences
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Jonathan Druart 2020-01-24 12:51:14 UTC
Created attachment 97880 [details] [review]
Bug 24509: Fix API relared tests failing on MySQL8

This patch makes a trivial change to the tests so they catch the way
MySQL 8 reports the duplicate key message. The difference on the API
error message is irrelevant and so it is ok to just make the tests try
both MySQL 8 output and the rest of the supported engines.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t \
           t/db_dependent/api/v1/libraries.t \
           t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail due to warning and conflict message differences
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 3 Jonathan Druart 2020-01-24 12:51:28 UTC
Thanks Tomas!
Comment 4 Martin Renvoize (ashimema) 2020-01-24 15:21:30 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 5 Joy Nelson 2020-02-10 22:11:05 UTC
not pushed to 19.11.x branch