summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-12-05 14:15:08 +0100
committerantirez <antirez@gmail.com>2016-12-05 14:19:03 +0100
commitf20f3ead1b065ee704abdcf659cf23ab8c8799d4 (patch)
treeaedca41b15b92a3e459eacfb9e7c0fb3ad74c66c
parent8c22086c34a3d6538387d0f08ea1db61884d03be (diff)
downloadredis-f20f3ead1b065ee704abdcf659cf23ab8c8799d4.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.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