From 66ea178cb620491ef04411e2cbfc8f78e6a8ab4e Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Tue, 20 Jun 2023 17:50:03 +0800 Subject: [PATCH] adding geo command edge cases tests (#12274) For geosearch and georadius we have already test coverage for wrong type, but we dont have for geodist, geohash, geopos commands. So adding the wrong type test cases for geodist, geohash, geopos commands. Existing code, we have verify_geo_edge_response_bymember function for wrong type test cases which has member as an option. But the function is being called in other test cases where the output is not inline with these commnds(geodist, geohash, geopos). So I could not include these commands(geodist, geohash, geopos) as part of existing function, hence implemented a new function verify_geo_edge_response_generic and called from the test case. --- tests/unit/geo.tcl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/unit/geo.tcl b/tests/unit/geo.tcl index 85c9485e4..6175329da 100644 --- a/tests/unit/geo.tcl +++ b/tests/unit/geo.tcl @@ -99,6 +99,18 @@ proc verify_geo_edge_response_bymember {expected_response expected_store_respons assert_match $expected_store_response $response } +proc verify_geo_edge_response_generic {expected_response} { + catch {r geodist src{t} member 1 km} response + assert_match $expected_response $response + + catch {r geohash src{t} member} response + assert_match $expected_response $response + + catch {r geopos src{t} member} response + assert_match $expected_response $response +} + + # The following list represents sets of random seed, search position # and radius that caused bugs in the past. It is used by the randomized # test later as a starting point. When the regression vectors are scanned @@ -128,6 +140,7 @@ start_server {tags {"geo"}} { verify_geo_edge_response_bylonlat "WRONGTYPE*" "WRONGTYPE*" verify_geo_edge_response_bymember "WRONGTYPE*" "WRONGTYPE*" + verify_geo_edge_response_generic "WRONGTYPE*" } test {GEO with non existing src key} {