Bugzilla – Attachment 39430 Details for
Bug 14256
Tests for TestBuilder fail randomly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14256: Make TestBuilder regenerates a string if to short
Bug-14256-Make-TestBuilder-regenerates-a-string-if.patch (text/plain), 1.31 KB, created by
Jonathan Druart
on 2015-05-22 16:45:25 UTC
(
hide
)
Description:
Bug 14256: Make TestBuilder regenerates a string if to short
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-05-22 16:45:25 UTC
Size:
1.31 KB
patch
obsolete
>From 4c127543795b276b9683e0e0300363b646f844b2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@koha-community.org> >Date: Fri, 22 May 2015 18:39:11 +0200 >Subject: [PATCH] Bug 14256: Make TestBuilder regenerates a string if to short > >In some cases, especially branchcode and categorycode, the generated >string for a primary key already existed in DB. >Which make the tests fail, and the data are not gererated. > >This patch regenerate a string if the one generated is too short and can >be longer. > >Test plan: >Use the diff from the previous comment, and confirm that the tests only >fail in the very few cases. > >QA: Actually I don't know if the better could be to use the existing >value, but maybe not... >--- > t/lib/TestBuilder.pm | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 72364e3..826ab1a 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -299,7 +299,11 @@ sub _gen_text { > $regex = '[A-Za-z]'; > } > my $random = String::Random->new( max => $size ); >- return $random->randregex($regex); >+ my $string = $random->randregex($regex); >+ while ( defined $size and $size > 2 and length( $string ) <= 2 ) { >+ $string = $random->randregex($regex); >+ } >+ return $string; > } > > sub _gen_set_enum { >-- >2.1.0
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 14256
:
39430
|
39463
|
39788
|
39789
|
39824
|
39825
|
39835
|
39836
|
39854
|
39855
|
40041
|
40042