Description
Jonathan Druart
2015-05-13 13:41:32 UTC
Created attachment 39138 [details] [review] Bug 14105: TestBuilder - A random string should not be longer than the DB field t::lib::TestBuilder::_gen_text does not use correctly the regex and the max parameter to generate the random string (String::Random). This can cause future tests to fail. Created attachment 39139 [details]
To reproduce the issue
Launch this script several times, without applying the patch.
If the generated string for categorycode has a length > 10, you will see a difference.
After applying the patch, the difference should never occur.
Created attachment 39200 [details] [review] [SIGNED-OFF] Bug 14195: TestBuilder - A random string should not be longer than the DB field t::lib::TestBuilder::_gen_text does not use correctly the regex and the max parameter to generate the random string (String::Random). This can cause future tests to fail. http://bugs.koha-community.org/show_bug.cgi?id=14195 Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Script tested, problem occurs, patch fixes it. Bad number on commit subject No errors Created attachment 39201 [details] [review] Bug 14195: (followup) increment number of tests Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Small question before passing QA: why do you decrement $size here: + if ( defined $size and $size > 1 ) { + $size--; (In reply to Marcel de Rooy from comment #5) > Small question before passing QA: why do you decrement $size here: > > + if ( defined $size and $size > 1 ) { > + $size--; Because the regex, in this case, is [A-Za-z][A-Za-z0-9_]* And the max size passed to String::Random is related to the wild card, not the the size of the complete string. Created attachment 39340 [details] [review] Bug 14195: TestBuilder - A random string should not be longer than the DB field t::lib::TestBuilder::_gen_text does not use correctly the regex and the max parameter to generate the random string (String::Random). This can cause future tests to fail. http://bugs.koha-community.org/show_bug.cgi?id=14195 Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Script tested, problem occurs, patch fixes it. Bad number on commit subject No errors Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 39341 [details] [review] Bug 14195: (followup) increment number of tests Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> (In reply to Jonathan Druart from comment #6) > Because the regex, in this case, is > [A-Za-z][A-Za-z0-9_]* > And the max size passed to String::Random is related to the wild card, not > the the size of the complete string. Fine. Could have read this in your comment :) Just not very intuitive Random parameter.. Thanks. Patch pushed to master. Thanks Jonathan! |