Bug 21597 - Test suite is still failing with new default SQL modes
Summary: Test suite is still failing with new default SQL modes
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
: 21594 (view as bug list)
Depends on: 20144 20521 21593 21596 21598 21599
Blocks: 21600 21613
  Show dependency treegraph
 
Reported: 2018-10-18 11:27 UTC by Jonathan Druart
Modified: 2022-03-22 14:49 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:


Attachments
Bug 21597: Column 'notforloan' cannot be null (1.91 KB, patch)
2018-10-18 12:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21597: Field 'amount' doesn't have a default value (3.07 KB, patch)
2018-10-18 12:10 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21597: Data too long for column 'invitekey' (1.62 KB, patch)
2018-10-18 12:11 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21597: Incorrect date value: '0' for column 'onloan' (1.08 KB, patch)
2018-10-18 12:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21597: Field 'description' doesn't have a default value (2.73 KB, patch)
2018-10-18 12:24 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21597: Incorrect decimal value: 't_value_bib639' for column 'price' (1.61 KB, patch)
2018-10-18 12:27 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21597: Column 'notforloan' cannot be null (1.96 KB, patch)
2018-10-18 13:04 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 21597: Field 'amount' doesn't have a default value (3.12 KB, patch)
2018-10-18 13:04 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 21597: Data too long for column 'invitekey' (1.67 KB, patch)
2018-10-18 13:04 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 21597: Incorrect date value: '0' for column 'onloan' (1.13 KB, patch)
2018-10-18 13:04 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 21597: Field 'description' doesn't have a default value (2.77 KB, patch)
2018-10-18 13:04 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 21597: Incorrect decimal value: 't_value_bib639' for column 'price' (1.66 KB, patch)
2018-10-18 13:04 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 21597: Column 'notforloan' cannot be null (2.03 KB, patch)
2018-10-18 14:11 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21597: Field 'amount' doesn't have a default value (3.19 KB, patch)
2018-10-18 14:11 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21597: Data too long for column 'invitekey' (1.74 KB, patch)
2018-10-18 14:12 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21597: Incorrect date value: '0' for column 'onloan' (1.20 KB, patch)
2018-10-18 14:12 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21597: Field 'description' doesn't have a default value (2.85 KB, patch)
2018-10-18 14:12 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21597: Incorrect decimal value: 't_value_bib639' for column 'price' (1.73 KB, patch)
2018-10-18 14:12 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2018-10-18 11:27:59 UTC
We pushed bug 20521 to enable the problematic SQL modes for dev installs, and now new tests (since bug 20144 has been pushed) are failing.

Let's fix them again.
Comment 1 Jonathan Druart 2018-10-18 11:30:12 UTC
This will be an omnibus
Comment 2 Jonathan Druart 2018-10-18 11:31:03 UTC
Bug 21593 - Remove Group by clause in GetAuthValueDropbox

'koha_kohadev.me.id' isn't in GROUP BY
Comment 3 Jonathan Druart 2018-10-18 11:36:00 UTC
Bug 21598 - budget_parent_id isn't in GROUP BY - GetBudgetHierarchy
Comment 4 Jonathan Druart 2018-10-18 11:41:31 UTC
Bug 21599 - Incorrect decimal value: '' for column 'defaultreplacecost' - Cannot create item type
Comment 5 Jonathan Druart 2018-10-18 11:47:37 UTC
Bug 21596 - Should not set "" as default for some columns during patron import

Patron import is failing, as well as the tests t/db_dependent/Koha/Patrons/Import.t
Comment 6 Jonathan Druart 2018-10-18 12:08:18 UTC
The previous bug reports are fixing bugs found by tests but impacting the interface.

I am going to submit here the fixes for the tests.
Comment 7 Jonathan Druart 2018-10-18 12:09:35 UTC
Created attachment 80812 [details] [review]
Bug 21597: Column 'notforloan' cannot be null

Fix t/db_dependent/Circulation.t

items.notforloan:
  `notforloan` tinyint(1) NOT NULL DEFAULT '0',

t/db_dependent/Circulation.t .. 115/119 DBD::mysql::st execute failed: Column 'notforloan' cannot be null [for Statement "UPDATE `items` SET `notforloan` = ? WHERE ( `itemnumber` = ? )" with ParamValues: 0=undef, 1='1046'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
        # No tests run!

    #   Failed test 'No tests run for subtest "item-level_itypes = 0"'
    #   at t/db_dependent/Circulation.t line 2356.
    # Looks like you failed 1 test of 2.

 #   Failed test 'CanBookBeIssued | notforloan'
 #   at t/db_dependent/Circulation.t line 2359.
Can't locate object method "rethrow" via package "DBD::mysql::st execute failed: Column 'notforloan' cannot be null [for Statement "UPDATE `items` SET `notforloan` = ? WHERE ( `itemnumber` = ? )" with ParamValues: 0=undef, 1='1046'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
Comment 8 Jonathan Druart 2018-10-18 12:10:31 UTC
Created attachment 80813 [details] [review]
Bug 21597: Field 'amount' doesn't have a default value

Fix t/db_dependent/Accounts.t

Default value could be 0, or left as it.
It seems that the different initialisation we have in the code pass a
value for 'amount'

account_offsets.amount
  `amount` decimal(26,6) NOT NULL,

DBIx::Class::Storage::DBI::_dbh_execute(): Field 'amount' doesn't
have a default value at /home/vagrant/kohaclone/Koha/Object.pm line 125
Comment 9 Jonathan Druart 2018-10-18 12:11:14 UTC
Created attachment 80814 [details] [review]
Bug 21597: Data too long for column 'invitekey'

Fix t/db_dependent/Virtualshelves.t

virtualshelfshares.invitekey
  `invitekey` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,

We should not insert a longer string!

DBIx::Class::Storage::DBI::_dbh_execute(): Data too long for column
'invitekey' at row 1 at /home/vagrant/kohaclone/Koha/Object.pm line 125
Comment 10 Jonathan Druart 2018-10-18 12:12:18 UTC
Created attachment 80815 [details] [review]
Bug 21597: Incorrect date value: '0' for column 'onloan'

Fix t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t

items.onloan
  `onloan` date DEFAULT NULL,

DBIx::Class::Storage::DBI::_dbh_execute(): Incorrect date value: '0' for
column 'onloan' at row 1 at /home/vagrant/kohaclone/t/lib/TestBuilder.pm
line 288
Comment 11 Jonathan Druart 2018-10-18 12:24:15 UTC
Created attachment 80816 [details] [review]
Bug 21597: Field 'description' doesn't have a default value

Nick proposed another fix, see bug 21594.
The interface does not explode so I do not think we should make a DB
update in a rush.

Fix t/db_dependent/Koha/Object.t and t/db_dependent/Koha/ApiKeys.t

api_keys.description and api_keys.secret:
  `secret` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,

    #   Failed test 'Exception is thrown correctly'
    #   at t/db_dependent/Koha/Object.t line 262.
    # expecting: Koha::Exceptions::Object::FKConstraint
    # found: DBIx::Class::Exception (DBIx::Class::Storage::DBI::_dbh_execute(): Field 'description' doesn't have a default value at /home/vagrant/kohaclone/Koha/Object.pm line 125
    # )
    # Looks like you planned 7 tests but ran 1.
    # Looks like you failed 1 test of 1 run.

and later, but not related:
Can't locate object method "message" via package
"DBIx::Class::Exception" at t/db_dependent/Koha/Object.t line 264.
Comment 12 Jonathan Druart 2018-10-18 12:27:49 UTC
Created attachment 80821 [details] [review]
Bug 21597: Incorrect decimal value: 't_value_bib639' for column 'price'

Fix t/db_dependent/selenium/basic_workflow.t

We want to send specific values depending on the data type in DB
For instance integer, or varchar(10)
Comment 13 Jonathan Druart 2018-10-18 12:30:12 UTC
Ready for testing!
Comment 14 Nick Clemens 2018-10-18 13:04:33 UTC
Created attachment 80829 [details] [review]
Bug 21597: Column 'notforloan' cannot be null

Fix t/db_dependent/Circulation.t

items.notforloan:
  `notforloan` tinyint(1) NOT NULL DEFAULT '0',

t/db_dependent/Circulation.t .. 115/119 DBD::mysql::st execute failed: Column 'notforloan' cannot be null [for Statement "UPDATE `items` SET `notforloan` = ? WHERE ( `itemnumber` = ? )" with ParamValues: 0=undef, 1='1046'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
        # No tests run!

    #   Failed test 'No tests run for subtest "item-level_itypes = 0"'
    #   at t/db_dependent/Circulation.t line 2356.
    # Looks like you failed 1 test of 2.

 #   Failed test 'CanBookBeIssued | notforloan'
 #   at t/db_dependent/Circulation.t line 2359.
Can't locate object method "rethrow" via package "DBD::mysql::st execute failed: Column 'notforloan' cannot be null [for Statement "UPDATE `items` SET `notforloan` = ? WHERE ( `itemnumber` = ? )" with ParamValues: 0=undef, 1='1046'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 15 Nick Clemens 2018-10-18 13:04:37 UTC
Created attachment 80830 [details] [review]
Bug 21597: Field 'amount' doesn't have a default value

Fix t/db_dependent/Accounts.t

Default value could be 0, or left as it.
It seems that the different initialisation we have in the code pass a
value for 'amount'

account_offsets.amount
  `amount` decimal(26,6) NOT NULL,

DBIx::Class::Storage::DBI::_dbh_execute(): Field 'amount' doesn't
have a default value at /home/vagrant/kohaclone/Koha/Object.pm line 125

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 16 Nick Clemens 2018-10-18 13:04:41 UTC
Created attachment 80831 [details] [review]
Bug 21597: Data too long for column 'invitekey'

Fix t/db_dependent/Virtualshelves.t

virtualshelfshares.invitekey
  `invitekey` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,

We should not insert a longer string!

DBIx::Class::Storage::DBI::_dbh_execute(): Data too long for column
'invitekey' at row 1 at /home/vagrant/kohaclone/Koha/Object.pm line 125

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 17 Nick Clemens 2018-10-18 13:04:48 UTC
Created attachment 80832 [details] [review]
Bug 21597: Incorrect date value: '0' for column 'onloan'

Fix t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t

items.onloan
  `onloan` date DEFAULT NULL,

DBIx::Class::Storage::DBI::_dbh_execute(): Incorrect date value: '0' for
column 'onloan' at row 1 at /home/vagrant/kohaclone/t/lib/TestBuilder.pm
line 288

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 18 Nick Clemens 2018-10-18 13:04:52 UTC
Created attachment 80833 [details] [review]
Bug 21597: Field 'description' doesn't have a default value

Nick proposed another fix, see bug 21594.
The interface does not explode so I do not think we should make a DB
update in a rush.

Fix t/db_dependent/Koha/Object.t and t/db_dependent/Koha/ApiKeys.t

api_keys.description and api_keys.secret:
  `secret` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,

    #   Failed test 'Exception is thrown correctly'
    #   at t/db_dependent/Koha/Object.t line 262.
    # expecting: Koha::Exceptions::Object::FKConstraint
    # found: DBIx::Class::Exception (DBIx::Class::Storage::DBI::_dbh_execute(): Field 'description' doesn't have a default value at /home/vagrant/kohaclone/Koha/Object.pm line 125
    # )
    # Looks like you planned 7 tests but ran 1.
    # Looks like you failed 1 test of 1 run.

and later, but not related:
Can't locate object method "message" via package
"DBIx::Class::Exception" at t/db_dependent/Koha/Object.t line 264.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 19 Nick Clemens 2018-10-18 13:04:55 UTC
Created attachment 80834 [details] [review]
Bug 21597: Incorrect decimal value: 't_value_bib639' for column 'price'

Fix t/db_dependent/selenium/basic_workflow.t

We want to send specific values depending on the data type in DB
For instance integer, or varchar(10)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 20 Jonathan Druart 2018-10-18 13:24:39 UTC
Last failure seem to be api/v1/patrons.t but I did not manage to fix it. Opened a new bug report:
Bug 21600 - t/db_dependent/api/v1/patrons.t is failing with new SQL modes
Comment 21 Martin Renvoize 2018-10-18 14:11:53 UTC
Created attachment 80852 [details] [review]
Bug 21597: Column 'notforloan' cannot be null

Fix t/db_dependent/Circulation.t

items.notforloan:
  `notforloan` tinyint(1) NOT NULL DEFAULT '0',

t/db_dependent/Circulation.t .. 115/119 DBD::mysql::st execute failed: Column 'notforloan' cannot be null [for Statement "UPDATE `items` SET `notforloan` = ? WHERE ( `itemnumber` = ? )" with ParamValues: 0=undef, 1='1046'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
        # No tests run!

    #   Failed test 'No tests run for subtest "item-level_itypes = 0"'
    #   at t/db_dependent/Circulation.t line 2356.
    # Looks like you failed 1 test of 2.

 #   Failed test 'CanBookBeIssued | notforloan'
 #   at t/db_dependent/Circulation.t line 2359.
Can't locate object method "rethrow" via package "DBD::mysql::st execute failed: Column 'notforloan' cannot be null [for Statement "UPDATE `items` SET `notforloan` = ? WHERE ( `itemnumber` = ? )" with ParamValues: 0=undef, 1='1046'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 22 Martin Renvoize 2018-10-18 14:11:58 UTC
Created attachment 80853 [details] [review]
Bug 21597: Field 'amount' doesn't have a default value

Fix t/db_dependent/Accounts.t

Default value could be 0, or left as it.
It seems that the different initialisation we have in the code pass a
value for 'amount'

account_offsets.amount
  `amount` decimal(26,6) NOT NULL,

DBIx::Class::Storage::DBI::_dbh_execute(): Field 'amount' doesn't
have a default value at /home/vagrant/kohaclone/Koha/Object.pm line 125

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 23 Martin Renvoize 2018-10-18 14:12:01 UTC
Created attachment 80854 [details] [review]
Bug 21597: Data too long for column 'invitekey'

Fix t/db_dependent/Virtualshelves.t

virtualshelfshares.invitekey
  `invitekey` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,

We should not insert a longer string!

DBIx::Class::Storage::DBI::_dbh_execute(): Data too long for column
'invitekey' at row 1 at /home/vagrant/kohaclone/Koha/Object.pm line 125

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 24 Martin Renvoize 2018-10-18 14:12:06 UTC
Created attachment 80855 [details] [review]
Bug 21597: Incorrect date value: '0' for column 'onloan'

Fix t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t

items.onloan
  `onloan` date DEFAULT NULL,

DBIx::Class::Storage::DBI::_dbh_execute(): Incorrect date value: '0' for
column 'onloan' at row 1 at /home/vagrant/kohaclone/t/lib/TestBuilder.pm
line 288

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 25 Martin Renvoize 2018-10-18 14:12:09 UTC
Created attachment 80856 [details] [review]
Bug 21597: Field 'description' doesn't have a default value

Nick proposed another fix, see bug 21594.
The interface does not explode so I do not think we should make a DB
update in a rush.

Fix t/db_dependent/Koha/Object.t and t/db_dependent/Koha/ApiKeys.t

api_keys.description and api_keys.secret:
  `secret` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,

    #   Failed test 'Exception is thrown correctly'
    #   at t/db_dependent/Koha/Object.t line 262.
    # expecting: Koha::Exceptions::Object::FKConstraint
    # found: DBIx::Class::Exception (DBIx::Class::Storage::DBI::_dbh_execute(): Field 'description' doesn't have a default value at /home/vagrant/kohaclone/Koha/Object.pm line 125
    # )
    # Looks like you planned 7 tests but ran 1.
    # Looks like you failed 1 test of 1 run.

and later, but not related:
Can't locate object method "message" via package
"DBIx::Class::Exception" at t/db_dependent/Koha/Object.t line 264.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 26 Martin Renvoize 2018-10-18 14:12:13 UTC
Created attachment 80857 [details] [review]
Bug 21597: Incorrect decimal value: 't_value_bib639' for column 'price'

Fix t/db_dependent/selenium/basic_workflow.t

We want to send specific values depending on the data type in DB
For instance integer, or varchar(10)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 27 Martin Renvoize 2018-10-18 14:12:38 UTC
Straightforward fixes to tests.

Passing QA
Comment 28 Nick Clemens 2018-10-18 14:31:51 UTC
Patches here pushed to master, will need an new omnibus or to adjust and reopen
Comment 29 Jonathan Druart 2018-10-18 19:49:01 UTC
(In reply to Nick Clemens from comment #28)
> Patches here pushed to master, will need an new omnibus or to adjust and
> reopen

With bug 21600 the tests should be ok. Others are not tests related (even if tests should have caught them!)
Comment 30 Martin Renvoize 2018-11-05 12:25:02 UTC
Pushed to 18.05.x for 18.05.06
Comment 31 Fridolin Somers 2018-11-28 08:23:22 UTC
I pass for new default SQL modes in 17.11.x
Comment 32 Jonathan Druart 2022-03-22 14:49:57 UTC
*** Bug 21594 has been marked as a duplicate of this bug. ***