Bug 21613 - Turn strict SQL modes on for tests
Summary: Turn strict SQL modes on for tests
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 21597
Blocks: 21717
  Show dependency treegraph
 
Reported: 2018-10-18 23:05 UTC by Jonathan Druart
Modified: 2019-10-14 19:56 UTC (History)
3 users (show)

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


Attachments
Bug 21613: Add a test (1.46 KB, patch)
2018-10-18 23:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21613: Turn strict SQL modes on for tests (1.76 KB, patch)
2018-10-18 23:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21613: Add a test (1.55 KB, patch)
2018-10-19 07:38 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 21613: Turn strict SQL modes on for tests (1.85 KB, patch)
2018-10-19 07:38 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 21613: (QA follow-up) Resolve warning on $ENV{_} (1.43 KB, patch)
2018-10-19 08:23 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 21613: (QA follow-up) Resolve warning on $ENV{_} (1.47 KB, patch)
2018-10-19 14:38 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21613: (QA follow-up) Resolve warning on $ENV{_} - avoid autovivification (1.43 KB, patch)
2018-10-19 14:38 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21613: Add a test (1.57 KB, patch)
2018-10-28 09:58 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21613: Turn strict SQL modes on for tests (1.88 KB, patch)
2018-10-28 09:58 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21613: (QA follow-up) Resolve warning on $ENV{_} (1.53 KB, patch)
2018-10-28 09:58 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21613: (QA follow-up) Resolve warning on $ENV{_} - avoid autovivification (1.49 KB, patch)
2018-10-28 09:58 UTC, Katrin Fischer
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 23:05:10 UTC
In order to make sure developers will be aware of possible regressions we should turn the strict SQL mode on for tests.
Comment 1 Jonathan Druart 2018-10-18 23:09:44 UTC
Created attachment 80887 [details] [review]
Bug 21613: Add a test
Comment 2 Jonathan Druart 2018-10-18 23:09:48 UTC
Created attachment 80888 [details] [review]
Bug 21613: Turn strict SQL modes on for tests

This patch will turn the strict SQL modes on When tests are ran with prove.

Test plan:
- Apply the first patch
- prove t/db_dependent/Koha/Database.t
=> Will pass if you have <strict_sql_modes>1</strict_sql_modes> in your
koha-conf.xml
=> Will fail otherwise
- Apply the second patch
- prove t/db_dependent/Koha/Database.t
=> Will pass whatever the value of strict_sql_modes in your
koha-conf.xml
Comment 3 Marcel de Rooy 2018-10-19 07:38:40 UTC
Created attachment 80896 [details] [review]
Bug 21613: Add a test

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Marcel de Rooy 2018-10-19 07:38:45 UTC
Created attachment 80897 [details] [review]
Bug 21613: Turn strict SQL modes on for tests

This patch will turn the strict SQL modes on When tests are ran with prove.

Test plan:
- Apply the first patch
- prove t/db_dependent/Koha/Database.t
=> Will pass if you have <strict_sql_modes>1</strict_sql_modes> in your
koha-conf.xml
=> Will fail otherwise
- Apply the second patch
- prove t/db_dependent/Koha/Database.t
=> Will pass whatever the value of strict_sql_modes in your
koha-conf.xml

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2018-10-19 08:23:14 UTC
Created attachment 80904 [details] [review]
Bug 21613: (QA follow-up) Resolve warning on $ENV{_}

Some shells may not pass the program name in underscore, and cron also
does not like it here:
Use of uninitialized value $ENV{"_"} in pattern match (m//) at Koha/Database.pm line 79.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Jonathan Druart 2018-10-19 14:38:05 UTC
Created attachment 80936 [details] [review]
Bug 21613: (QA follow-up) Resolve warning on $ENV{_}

Some shells may not pass the program name in underscore, and cron also
does not like it here:
Use of uninitialized value $ENV{"_"} in pattern match (m//) at Koha/Database.pm line 79.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2018-10-19 14:38:10 UTC
Created attachment 80937 [details] [review]
Bug 21613: (QA follow-up) Resolve warning on $ENV{_} - avoid autovivification

See C4::Circulation::SendCirculationAlert
3355     my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_NO_TABLE_LOCKS};

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Katrin Fischer 2018-10-28 09:58:38 UTC
Created attachment 81387 [details] [review]
Bug 21613: Add a test

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2018-10-28 09:58:43 UTC
Created attachment 81388 [details] [review]
Bug 21613: Turn strict SQL modes on for tests

This patch will turn the strict SQL modes on When tests are ran with prove.

Test plan:
- Apply the first patch
- prove t/db_dependent/Koha/Database.t
=> Will pass if you have <strict_sql_modes>1</strict_sql_modes> in your
koha-conf.xml
=> Will fail otherwise
- Apply the second patch
- prove t/db_dependent/Koha/Database.t
=> Will pass whatever the value of strict_sql_modes in your
koha-conf.xml

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2018-10-28 09:58:47 UTC
Created attachment 81389 [details] [review]
Bug 21613: (QA follow-up) Resolve warning on $ENV{_}

Some shells may not pass the program name in underscore, and cron also
does not like it here:
Use of uninitialized value $ENV{"_"} in pattern match (m//) at Koha/Database.pm line 79.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2018-10-28 09:58:51 UTC
Created attachment 81390 [details] [review]
Bug 21613: (QA follow-up) Resolve warning on $ENV{_} - avoid autovivification

See C4::Circulation::SendCirculationAlert
3355     my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_NO_TABLE_LOCKS};

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Nick Clemens 2018-10-29 01:19:31 UTC
Awesome work all!

Pushed to master for 18.11
Comment 13 Martin Renvoize 2018-11-08 15:48:41 UTC
I'm backporting allot of the sql fixes, but some are not trivial. As such I'm holding off on backporting this trigger whilst I ponder the worthwhileness of backporting the less trivial cases.