When an id is generated by TestBuilder (branchcode for instance) and the
size of the generated string is 1, we have too many chances to get
"Violation of unique constraint in Branch".
This patch increases the number of retries to 5.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended to make room for follow-up.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
my @columns = $self->schema->source($source)->columns;
my %unique_constraints = $self->schema->source($source)->unique_constraints();
- my $build_value = 3;
- # we try max three times if there are unique constraints
+ my $build_value = 5;
+ # we try max $build_value times if there are unique constraints
BUILD_VALUE: while ( $build_value ) {
# generate random values for all columns
for my $col_name( @columns ) {
$regex = '[A-Za-z]';
}
my $random = String::Random->new( max => $size );
- return $random->randregex($regex);
+ my $text = $random->randregex($regex);
+ return $text;
}
sub _gen_set_enum {