Bugzilla – Attachment 151678 Details for
Bug 33834
api/v1/ill_requests.t fails randomly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33834: Fix random failure on api/v1/ill_requests.t
Bug-33834-Fix-random-failure-on-apiv1illrequestst.patch (text/plain), 2.96 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-05-25 13:18:23 UTC
(
hide
)
Description:
Bug 33834: Fix random failure on api/v1/ill_requests.t
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-05-25 13:18:23 UTC
Size:
2.96 KB
patch
obsolete
>From f27b4a00beba4c8bdc673546586a9a97533d042a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 25 May 2023 10:15:08 -0300 >Subject: [PATCH] Bug 33834: Fix random failure on api/v1/ill_requests.t > >This patch makes the GET request results more deterministic so we avoid >random failures. It does so by adding a fixed value to each ILL request >and then sorting by it. > >To test: >1. Run: > $ DB_IMAGE=mysqli:8.0 ktd up -d > # wait until it finished: > $ ktd --logs >2. Run: > $ ktd --shell > k$ prove t/db_dependent/api/v1/ill_requests.t > (repeat a few times) >=> FAIL: It sometimes fails >3. Apply this patch >4. Repeat 2 >=> SUCCESS: It doesn't fail >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/ill_requests.t | 29 ++++++++++++++++++++++++---- > 1 file changed, 25 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/api/v1/ill_requests.t b/t/db_dependent/api/v1/ill_requests.t >index dc3974e5d31..e553053af36 100755 >--- a/t/db_dependent/api/v1/ill_requests.t >+++ b/t/db_dependent/api/v1/ill_requests.t >@@ -139,9 +139,30 @@ subtest 'list() tests' => sub { > }; > > # Create some ILL requests >- my $req_1 = $builder->build_object({ class => 'Koha::Illrequests', value => { borrowernumber => $patron->borrowernumber, status => $request_status->{code}, backend =>$backend->name } }); >- my $req_2 = $builder->build_object({ class => 'Koha::Illrequests', value => { status => $request_status->{code}, backend =>$backend->name , status_alias => $av->authorised_value } } ); >- my $ret = $builder->build_object({ class => 'Koha::Illrequests', value => { status => 'RET' } } ); >+ my $req_1 = $builder->build_object( >+ { >+ class => 'Koha::Illrequests', >+ value => { >+ borrowernumber => $patron->borrowernumber, >+ status => $request_status->{code}, >+ backend => $backend->name, >+ notesstaff => '1' >+ } >+ } >+ ); >+ my $req_2 = $builder->build_object( >+ { >+ class => 'Koha::Illrequests', >+ value => { >+ status => $request_status->{code}, >+ backend => $backend->name, >+ status_alias => $av->authorised_value, >+ notesstaff => '2' >+ } >+ >+ } >+ ); >+ my $ret = $builder->build_object({ class => 'Koha::Illrequests', value => { status => 'RET' } }); > > # Three requests exist, expect all three to be returned > $t->get_ok("//$userid:$password@/api/v1/ill/requests") >@@ -209,7 +230,7 @@ subtest 'list() tests' => sub { > > # Hide 'RET', expect to return 2 'REQ' > t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', 'RET' ); >- $t->get_ok( "//$userid:$password@/api/v1/ill/requests" ) >+ $t->get_ok( "//$userid:$password@/api/v1/ill/requests?_order_by=staff_notes" ) > ->status_is(200) > ->json_is( [ $req_1->to_api, $req_2->to_api ]); > >-- >2.34.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 33834
:
151678
|
151719