Bugzilla – Attachment 127649 Details for
Bug 28692
Reduce DB action_log table size
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28692: (follow-up) Add tests
Bug-28692-follow-up-Add-tests.patch (text/plain), 2.76 KB, created by
Marcel de Rooy
on 2021-11-15 13:45:21 UTC
(
hide
)
Description:
Bug 28692: (follow-up) Add tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-11-15 13:45:21 UTC
Size:
2.76 KB
patch
obsolete
>From 263f0ac36f3c0c6e70398b632016918694c80dda Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 15 Nov 2021 13:42:02 +0000 >Subject: [PATCH] Bug 28692: (follow-up) Add tests >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run t/db_dependent/Log.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Log.t | 34 +++++++++++++++++++++++++++++++++- > 1 file changed, 33 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Log.t b/t/db_dependent/Log.t >index 2bdadb079e..0e46eea4c9 100755 >--- a/t/db_dependent/Log.t >+++ b/t/db_dependent/Log.t >@@ -15,7 +15,8 @@ > # with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 3; >+use Data::Dumper qw( Dumper ); >+use Test::More tests => 4; > > use C4::Context; > use C4::Log qw( logaction cronlogaction ); >@@ -150,4 +151,35 @@ subtest 'GDPR logging' => sub { > is( $logs->count, 1, 'We expect only one auth success line for this patron' ); > }; > >+subtest 'Reduce log size by unblessing Koha objects' => sub { >+ plan tests => 7; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $item = $builder->build_sample_item; >+ >+ logaction( 'MY_MODULE', 'TEST01', $item->itemnumber, $item, 'opac' ); >+ my $str = Dumper($item->unblessed); >+ my $logs = Koha::ActionLogs->search({ module => 'MY_MODULE', action => 'TEST01', object => $item->itemnumber }); >+ is( $logs->count, 1, 'Action found' ); >+ is( length($logs->next->info), length($str), 'Length exactly identical' ); >+ >+ logaction( 'CATALOGUING', 'MODIFY', $item->itemnumber, $item, 'opac' ); >+ $logs = Koha::ActionLogs->search({ module => 'CATALOGUING', action => 'MODIFY', object => $item->itemnumber }); >+ is( substr($logs->next->info, 0, 5), 'item ', 'Prefix item' ); >+ is( length($logs->reset->next->info), 5+length($str), 'Length + 5' ); >+ >+ my $hold = $builder->build_object({ class => 'Koha::Holds' }); >+ logaction( 'MY_CIRC_MODULE', 'TEST', $item->itemnumber, $hold, 'opac' ); >+ $logs = Koha::ActionLogs->search({ module => 'MY_CIRC_MODULE', action => 'TEST', object => $item->itemnumber }); >+ is( length($logs->next->info), length( Dumper($hold->unblessed)), 'Length of dumped unblessed hold' ); >+ >+ logaction( 'MY_MODULE', 'TEST02', $item->itemnumber, [], 'opac' ); >+ $logs = Koha::ActionLogs->search({ module => 'MY_MODULE', action => 'TEST02', object => $item->itemnumber }); >+ like( $logs->next->info, qr/^ARRAY\(/, 'Dumped arrayref' ); >+ >+ logaction( 'MY_MODULE', 'TEST03', $item->itemnumber, $builder, 'opac' ); >+ $logs = Koha::ActionLogs->search({ module => 'MY_MODULE', action => 'TEST03', object => $item->itemnumber }); >+ like( $logs->next->info, qr/^t::lib::TestBuilder/, 'Dumped TestBuilder object' ); >+}; >+ > $schema->storage->txn_rollback; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28692
:
122683
|
122782
|
125692
|
127289
|
127446
|
127574
|
127575
|
127576
|
127577
|
127630
|
127639
|
127640
|
127641
|
127642
|
127645
|
127646
|
127647
|
127648
| 127649