Skip to content
Permalink
Browse files
Tests for invalid geoip file
Added a test to make sure that things don't crash if we're unable to
load the provided (or default) geoip file
  • Loading branch information
cohosh committed Mar 15, 2019
1 parent be4d245 commit 09dd27f9408b1ff3ff916e374bcd5f659ad5b26b
Showing with 6 additions and 0 deletions.
  1. +6 −0 broker/snowflake-broker_test.go
@@ -287,5 +287,11 @@ func TestGeoip(t *testing.T) {
So(GetCountryByAddr(tv6, "fd00:0:0:0:0:0:0:1"), ShouldEqual, "")
So(GetCountryByAddr(tv6, "0:0:0:0:0:0:0:0"), ShouldEqual, "")
So(GetCountryByAddr(tv6, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"), ShouldEqual, "")

// Make sure things behave properly if geoip file fails to load
ctx := NewBrokerContext()
ctx.metrics.LoadGeoipDatabases("invalid_filename", "invalid_filename6")
ctx.metrics.UpdateCountryStats("127.0.0.1")

})
}

0 comments on commit 09dd27f

Please sign in to comment.