From 106c66eee67be65246ee50ea59a4c0f27acf7e7e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Oct 2016 13:15:27 +0100 Subject: [PATCH] Bug 17426: Do not set AutoCommit in tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git grep AutoCommit t | grep 1 highlights that 1 test use AutoCommit set, it should not The other change removes the FIXME should has been fixed. Test plan: prove t/db_dependent/BackgroundJob.t t/db_dependent/Patron/Borrower_Discharge.t should still return green Signed-off-by: Marc Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall (cherry picked from commit ede157e9c09e08b772aaaaacd1a7eb64a2ecc9f6) Signed-off-by: Frédéric Demians --- t/db_dependent/BackgroundJob.t | 2 +- t/db_dependent/Patron/Borrower_Discharge.t | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/t/db_dependent/BackgroundJob.t b/t/db_dependent/BackgroundJob.t index 3cc5348bbf..7005594e0b 100644 --- a/t/db_dependent/BackgroundJob.t +++ b/t/db_dependent/BackgroundJob.t @@ -12,7 +12,7 @@ my $query = new CGI; # Generate a session id my $dbh = C4::Context->dbh; -$dbh->{AutoCommit} = 1; +$dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; my $session = C4::Auth::get_session; diff --git a/t/db_dependent/Patron/Borrower_Discharge.t b/t/db_dependent/Patron/Borrower_Discharge.t index 4090475faf..d3eeaef6b6 100644 --- a/t/db_dependent/Patron/Borrower_Discharge.t +++ b/t/db_dependent/Patron/Borrower_Discharge.t @@ -15,7 +15,7 @@ # with Koha; if not, see . use Modern::Perl; -use Test::More tests => 17; +use Test::More tests => 18; use Test::Warn; use MARC::Record; @@ -118,15 +118,8 @@ else { "Expected failure because of missing PDF::FromHTML."; } -# FIXME -# At this point, there is a problem with the AutoCommit off -# The transaction is bloked into DBIx::Class::Storage::DBI::_dbh_execute -# line my $rv = $sth->execute(); -# We are using 2 connections and the one used by Koha::Schema has the AutoCommit set to 1 -# Even if we switch off this flag, the connection will be blocked. -# The error is: -# DBIx::Class::ResultSet::create(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction [for Statement "INSERT INTO discharges ( borrower, needed, validated) VALUES ( ?, ?, ? )" with ParamValues: 0='121', 1='2014-01-08T16:38:29', 2=undef] at /home/koha/src/Koha/DataObject/Discharge.pm line 33 -#is( Koha::Service::Borrower::Discharge::request({ borrowernumber => $patron->{borrowernumber} }), 1, 'Discharge request sent' ); +# FIXME Should be a Koha::Object object +is( ref(Koha::Patron::Discharge::request({ borrowernumber => $patron->{borrowernumber} })), 'Koha::Schema::Result::Discharge', 'Discharge request sent' ); $schema->storage->txn_rollback; -- 2.39.5