Skip to content

Commit ea4d2f0

Browse files
Revert a change to the test code from the original commit, which is no longer necessary due to the next commit
1 parent 1b2afaf commit ea4d2f0

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

modules/ingest-geoip/src/internalClusterTest/java/org/elasticsearch/ingest/geoip/DatabaseNodeServiceIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private void assertValidDatabase(DatabaseNodeService databaseNodeService, String
9494
IpDatabase database = databaseNodeService.getDatabase(databaseFileName);
9595
assertNotNull(database);
9696
assertThat(database.getDatabaseType(), equalTo(databaseType));
97-
CacheableCountryResponse countryResponse = database.getResponse("89.160.20.128", GeoIpTestUtils::getCountry).result();
97+
CacheableCountryResponse countryResponse = database.getResponse("89.160.20.128", GeoIpTestUtils::getCountry);
9898
assertNotNull(countryResponse);
9999
assertThat(countryResponse.countryName(), equalTo("Sweden"));
100100
}

modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/ConfigDatabasesTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void testDatabasesUpdateExistingConfDatabase() throws Exception {
125125

126126
DatabaseReaderLazyLoader loader = configDatabases.getDatabase("GeoLite2-City.mmdb");
127127
assertThat(loader.getDatabaseType(), equalTo("GeoLite2-City"));
128-
CacheableCityResponse cityResponse = loader.getResponse("89.160.20.128", GeoIpTestUtils::getCity).result();
128+
CacheableCityResponse cityResponse = loader.getResponse("89.160.20.128", GeoIpTestUtils::getCity);
129129
assertThat(cityResponse.cityName(), equalTo("Tumba"));
130130
assertThat(cache.count(), equalTo(1));
131131
}
@@ -137,7 +137,7 @@ public void testDatabasesUpdateExistingConfDatabase() throws Exception {
137137

138138
DatabaseReaderLazyLoader loader = configDatabases.getDatabase("GeoLite2-City.mmdb");
139139
assertThat(loader.getDatabaseType(), equalTo("GeoLite2-City"));
140-
CacheableCityResponse cityResponse = loader.getResponse("89.160.20.128", GeoIpTestUtils::getCity).result();
140+
CacheableCityResponse cityResponse = loader.getResponse("89.160.20.128", GeoIpTestUtils::getCity);
141141
assertThat(cityResponse.cityName(), equalTo("Linköping"));
142142
assertThat(cache.count(), equalTo(1));
143143
});

modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpTestUtils.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,12 @@ public static void copyDefaultDatabases(final Path directory, ConfigDatabases co
7373
* <p>
7474
* Like this: {@code CacheableCityResponse city = loader.getResponse("some.ip.address", GeoIpTestUtils::getCity);}
7575
*/
76-
public static IpDataLookup.Result<MaxmindIpDataLookups.CacheableCityResponse> getCity(Reader reader, String ip) throws IOException {
76+
public static MaxmindIpDataLookups.CacheableCityResponse getCity(Reader reader, String ip) throws IOException {
7777
DatabaseRecord<CityResponse> record = reader.getRecord(InetAddresses.forString(ip), CityResponse.class);
7878
CityResponse data = record.getData();
7979
return data == null
8080
? null
81-
: new IpDataLookup.Result<>(
82-
MaxmindIpDataLookups.CacheableCityResponse.from(new CityResponse(data, ip, record.getNetwork(), List.of("en"))),
83-
ip,
84-
record.getNetwork().toString()
85-
);
81+
: MaxmindIpDataLookups.CacheableCityResponse.from(new CityResponse(data, ip, record.getNetwork(), List.of("en")));
8682
}
8783

8884
/**
@@ -91,16 +87,11 @@ public static IpDataLookup.Result<MaxmindIpDataLookups.CacheableCityResponse> ge
9187
* <p>
9288
* Like this: {@code CacheableCountryResponse country = loader.getResponse("some.ip.address", GeoIpTestUtils::getCountry);}
9389
*/
94-
public static IpDataLookup.Result<MaxmindIpDataLookups.CacheableCountryResponse> getCountry(Reader reader, String ip)
95-
throws IOException {
90+
public static MaxmindIpDataLookups.CacheableCountryResponse getCountry(Reader reader, String ip) throws IOException {
9691
DatabaseRecord<CountryResponse> record = reader.getRecord(InetAddresses.forString(ip), CountryResponse.class);
9792
CountryResponse data = record.getData();
9893
return data == null
9994
? null
100-
: new IpDataLookup.Result<>(
101-
MaxmindIpDataLookups.CacheableCountryResponse.from(new CountryResponse(data, ip, record.getNetwork(), List.of("en"))),
102-
ip,
103-
record.getNetwork().toString()
104-
);
95+
: MaxmindIpDataLookups.CacheableCountryResponse.from(new CountryResponse(data, ip, record.getNetwork(), List.of("en")));
10596
}
10697
}

0 commit comments

Comments
 (0)