summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-12-05 14:15:08 +0100
committerantirez <antirez@gmail.com>2016-12-05 14:16:46 +0100
commitb1fc06f7eb90b2b8a3c68085ac0970e3d3525b52 (patch)
treec9a176aab6b9f259b6f57ddfd0fcc78e070eebd1 /tests
parent001138aec3c9e9df9b3072da10477a44491ec918 (diff)
downloadredis-b1fc06f7eb90b2b8a3c68085ac0970e3d3525b52.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.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/geo.tcl14
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