diff options
author | antirez <antirez@gmail.com> | 2016-12-05 14:15:08 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2016-12-05 14:19:11 +0100 |
commit | 41994f2213f0f6cb3ef336d92bb0f8ced23e22a4 (patch) | |
tree | a4aa7bbd3e973db836deb157a6f4b4e3670ebe3d | |
parent | ef9b4cf0f0545962abb7a1f6ec5747f47195a662 (diff) | |
download | redis-41994f2213f0f6cb3ef336d92bb0f8ced23e22a4.tar.gz |
Geo: improve fuzz test.
The test now uses more diverse radius sizes, especially sizes near or
greater the whole earth surface are used, that are known to trigger edge
cases. Moreover the PRNG seeding was probably resulting into the same
sequence tested over and over again, now seeding unsing the current unix
time in milliseconds.
Related to #3631.
-rw-r--r-- | tests/unit/geo.tcl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/unit/geo.tcl b/tests/unit/geo.tcl index a08726d2e..44a0ae1bc 100644 --- a/tests/unit/geo.tcl +++ b/tests/unit/geo.tcl @@ -221,18 +221,26 @@ start_server {tags {"geo"}} { } test {GEOADD + GEORANGE randomized test} { - set attempt 20 + set attempt 30 while {[incr attempt -1]} { set rv [lindex $regression_vectors $rv_idx] incr rv_idx unset -nocomplain debuginfo - set srand_seed [randomInt 1000000] + set srand_seed [clock milliseconds] if {$rv ne {}} {set srand_seed [lindex $rv 0]} lappend debuginfo "srand_seed is $srand_seed" expr {srand($srand_seed)} ; # If you need a reproducible run r del mypoints - set radius_km [expr {[randomInt 200]+10}] + + if {[randomInt 10] == 0} { + # From time to time use very big radiuses + set radius_km [expr {[randomInt 50000]+10}] + } else { + # Normally use a few - ~200km radiuses to stress + # test the code the most in edge cases. + set radius_km [expr {[randomInt 200]+10}] + } if {$rv ne {}} {set radius_km [lindex $rv 1]} set radius_m [expr {$radius_km*1000}] geo_random_point search_lon search_lat |