Bugzilla – Attachment 39788 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.69 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-06-02 19:13:49 UTC
(
hide
)
Description:
Bug 14256: Make TestBuilder regenerates a string if to short
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-06-02 19:13:49 UTC
Size:
1.69 KB
patch
obsolete
>From ef825f9e97c8d1d2a3982ff810bcc05e0b0b26f5 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... > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >NOTE: Perhaps a hardcoded size like >=2 could be replaced by > the minimum of (+1 max string length in the field, size cap). > After a couple glitches testing, my bad, it does reduce > failures drastically. I had category code of length 4 in my > database at the time. >Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> >--- > 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.4.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 14256
:
39430
|
39463
|
39788
|
39789
|
39824
|
39825
|
39835
|
39836
|
39854
|
39855
|
40041
|
40042