From a7914c889180f303f0fa5752f2756949ca212c87 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 3 Jan 2018 09:12:32 +0200 Subject: [PATCH] geoipbackend: Use only our own database for tests Removes dependency to external data --- .../regression-tests/GeoLiteCity-Blocks.csv | 2 ++ .../regression-tests/GeoLiteCity-Location.csv | 2 ++ .../regression-tests/GeoLiteCity.dat.b64 | 17 +++++++---- regression-tests/backends/geoip-master | 28 ++++++++----------- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/modules/geoipbackend/regression-tests/GeoLiteCity-Blocks.csv b/modules/geoipbackend/regression-tests/GeoLiteCity-Blocks.csv index 3e0866adc..47d62d956 100644 --- a/modules/geoipbackend/regression-tests/GeoLiteCity-Blocks.csv +++ b/modules/geoipbackend/regression-tests/GeoLiteCity-Blocks.csv @@ -2,3 +2,5 @@ startIpNum,endIpNum,locId "2130706433","2130706433","1" "2130706434","2130706434","2" "2130706435","2130706435","3" +"16843008","16843264","4" +"16909056","16909312","5" diff --git a/modules/geoipbackend/regression-tests/GeoLiteCity-Location.csv b/modules/geoipbackend/regression-tests/GeoLiteCity-Location.csv index a0786c2ec..42faea714 100644 --- a/modules/geoipbackend/regression-tests/GeoLiteCity-Location.csv +++ b/modules/geoipbackend/regression-tests/GeoLiteCity-Location.csv @@ -2,3 +2,5 @@ locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode 1,"O1","L1","C1","00001",0,0,1,1 2,"O1","L2","C2","00002",0,0,2,2 3,"O1","L3","C3","00003",0,0,3,3 +4,"AU","OC","Melbourne","3095",1.0,1.0,4,4 +5,"US","NA","Mukilteo","98275",47.910000,-122.300000,819,5 diff --git a/modules/geoipbackend/regression-tests/GeoLiteCity.dat.b64 b/modules/geoipbackend/regression-tests/GeoLiteCity.dat.b64 index da06c5843..55667404d 100644 --- a/modules/geoipbackend/regression-tests/GeoLiteCity.dat.b64 +++ b/modules/geoipbackend/regression-tests/GeoLiteCity.dat.b64 @@ -1,5 +1,12 @@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BA +dxtAdxsAAAD2TDIAQzIAMDAwMDIAQHcbQHcbAAAA9kwzAEMzADAwMDAzAEB3G0B3GwAAABBPQwBN +ZWxib3VybmUAMzA5NQBQnhtQnhsAAADhTkEATXVraWx0ZW8AOTgyNzUAvMYi6M0IPX8MY3N2MmRh +dC5wef///wJTAAA= diff --git a/regression-tests/backends/geoip-master b/regression-tests/backends/geoip-master index a5eeffe65..74620be74 100644 --- a/regression-tests/backends/geoip-master +++ b/regression-tests/backends/geoip-master @@ -1,14 +1,8 @@ case $context in geoip|geoip-nsec3-narrow) set +e - if test "x$geoipregion" = "x"; then - echo "This test suite requires that you provide geoipregion which defines the region name produced by MaxMind database with geoipregionip address." - exit 1 - fi - if test "x$geoipregionip" = "x"; then - echo "This test suite requires that you have IP address bound to localhost interface and exported as variable geoipregionip" - exit 1 - fi + export geoipregion=${geoipregion:-oc} + export geoipregionip=${geoipregionip:-1.1.1.1} set -e testsdir=../modules/geoipbackend/regression-tests/ if test "$context" = "geoip-nsec3-narrow"; then @@ -39,9 +33,9 @@ domains: c3.l3.o1.city.geo.example.com: - a: 127.0.3.1 continent.geo.example.com: - - txt: Your continent is %cn + - txt: "Your continent is %cn" $geoipregion.service.geo.example.com: - - a: 62.236.200.4 + - a: $geoipregionip unknown.service.geo.example.com: - a: 127.0.0.1 services: @@ -51,19 +45,19 @@ domains: city.geo.example.com: '%ci.%re.%cc.city.geo.example.com' EOF cat > $testsdir/region-a-resolution/expected_result < $testsdir/region-cname-resolution/expected_result < $testsdir/text-interpolation/expected_result < $testsdir/GeoLiteCity.dat + geoipdatabase=${geoipdatabase:-$testsdir/GeoLiteCity.dat} + $RUNWRAPPER $PDNS --daemon=no --local-address=$address --local-port=$port --socket-dir=./ \ --no-shuffle --launch=geoip \ --cache-ttl=$cachettl --dname-processing --no-config \ --distributor-threads=1 \ - --geoip-zones-file=$testsdir/geo.yaml --geoip-database-files="/usr/share/GeoIP/GeoIP.dat $testsdir/GeoLiteCity.dat" \ + --geoip-zones-file=$testsdir/geo.yaml --geoip-database-files="$geoipdatabase" \ --module-dir=./modules --edns-subnet-processing=yes \ $geoipkeydir & ;; -- 2.40.0