Bugzilla – Attachment 169317 Details for
Bug 37389
REST API queries joining on extended_attributes may cause severe performance issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37389: [WIP] Update tests
Bug-37389-WIP-Update-tests.patch (text/plain), 4.13 KB, created by
Pedro Amorim
on 2024-07-22 16:20:23 UTC
(
hide
)
Description:
Bug 37389: [WIP] Update tests
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-07-22 16:20:23 UTC
Size:
4.13 KB
patch
obsolete
>From e5972a8859c80480c7a47d4c4bbec201f5922a40 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 19 Jul 2024 15:25:52 +0000 >Subject: [PATCH] Bug 37389: [WIP] Update tests > >This is not done yet, I've only updated it to have the tests pass, but >we need more. >--- > t/Koha/REST/Plugin/Query.t | 99 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 98 insertions(+), 1 deletion(-) > >diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t >index 2f816f4f14..cdc2450a7f 100755 >--- a/t/Koha/REST/Plugin/Query.t >+++ b/t/Koha/REST/Plugin/Query.t >@@ -318,10 +318,59 @@ get '/dbic_extended_attributes_join' => sub { > ]; > my $attributes = { 'prefetch' => ['extended_attributes'] }; > >+ my $result_set = Koha::Patrons->new; >+ > $c->dbic_extended_attributes_join( > { > 'filtered_params' => $filtered_params, >- 'attributes' => $attributes >+ 'attributes' => $attributes, >+ 'result_set' => $result_set >+ } >+ ); >+ >+ $c->render( json => { 'attributes' => $attributes, 'filtered_params' => $filtered_params }, status => 200 ); >+}; >+ >+get '/dbic_extended_attributes_join_additional_fields' => sub { >+ my ( $c, $args ) = @_; >+ >+ my $filtered_params = [ >+ { >+ '-and' => [ >+ [ >+ { >+ 'extended_attributes.attribute' => { 'like' => 'abc%' }, >+ 'extended_attributes.code' => [ >+ [ >+ 'test1', >+ 'test2' >+ ] >+ ] >+ } >+ ], >+ [ >+ { >+ 'extended_attributes.code' => [ >+ [ >+ 'test1', >+ 'test2' >+ ] >+ ], >+ 'extended_attributes.attribute' => { 'like' => '123%' } >+ } >+ ] >+ ] >+ } >+ ]; >+ my $attributes = { 'prefetch' => ['extended_attributes'] }; >+ >+ my $result_set = Koha::Object::Mixin::AdditionalFields->new; >+ >+ $c->dbic_extended_attributes_join( >+ { >+ 'filtered_params' => $filtered_params, >+ 'attributes' => $attributes, >+ 'result_set' => $result_set > } > ); > >@@ -634,3 +683,51 @@ subtest 'dbic_extended_attributes_join() tests' => sub { > ] > ); > }; >+ >+subtest 'dbic_extended_attributes_join_additional_fields() tests' => sub { >+ >+ plan tests => 4; >+ >+ my $t = Test::Mojo->new; >+ >+ $t->get_ok( '/dbic_extended_attributes_join_additional_fields' => { 'x-koha-embed' => 'extended_attributes' } )->json_has( >+ '/attributes' => { >+ 'join' => [ >+ 'extended_attributes', >+ 'extended_attributes' >+ ], >+ 'prefetch' => ['extended_attributes'] >+ } >+ ); >+ >+ $t->get_ok( '/dbic_extended_attributes_join' => { 'x-koha-embed' => 'extended_attributes' } )->json_has( >+ '/filtered_params' => [ >+ { >+ '-and' => [ >+ [ >+ { >+ 'extended_attributes.code' => [ >+ [ >+ 'test1', >+ 'test2' >+ ] >+ ], >+ 'extended_attributes.attribute' => { 'like' => 'abc%' } >+ } >+ ], >+ [ >+ { >+ 'extended_attributes_2.attribute' => { 'like' => '123%' }, >+ 'extended_attributes_2.code' => [ >+ [ >+ 'test1', >+ 'test2' >+ ] >+ ] >+ } >+ ] >+ ] >+ } >+ ] >+ ); >+}; >-- >2.39.2
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 37389
:
169130
|
169133
|
169140
|
169149
|
169159
|
169178
|
169185
|
169189
|
169191
|
169192
|
169234
|
169243
|
169244
|
169245
|
169246
|
169317
|
169318
|
169569
|
169570
|
169583
|
169584
|
169585
|
169586
|
169850
|
169851
|
169944
|
169945
|
169946
|
169954
|
169955
|
169956