Skip to content

Commit e448ea7

Browse files
committed
Rewrite this test slightly
1 parent 8642181 commit e448ea7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -550,23 +550,21 @@ public void testDatabaseNotReadyYet() throws Exception {
550550
config.put("field", "source_field");
551551
config.put("database_file", "GeoLite2-City.mmdb");
552552

553-
Map<String, Object> document = new HashMap<>();
554-
document.put("source_field", "89.160.20.128");
555-
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
556-
557553
GeoIpProcessor.DatabaseUnavailableProcessor processor = (GeoIpProcessor.DatabaseUnavailableProcessor) factory.create(
558554
null,
559555
null,
560556
null,
561557
config,
562558
null
563559
);
564-
processor.execute(ingestDocument);
565-
assertThat(ingestDocument.getSourceAndMetadata().get("geoip"), nullValue());
566-
assertThat(
567-
ingestDocument.getSourceAndMetadata().get("tags"),
568-
equalTo(List.of("_geoip_database_unavailable_GeoLite2-City.mmdb"))
569-
);
560+
561+
IngestDocument document;
562+
{
563+
document = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>(Map.of("source_field", "89.160.20.128")));
564+
processor.execute(document);
565+
assertThat(document.getSourceAndMetadata().get("geoip"), nullValue());
566+
assertThat(document.getSourceAndMetadata().get("tags"), equalTo(List.of("_geoip_database_unavailable_GeoLite2-City.mmdb")));
567+
}
570568
}
571569

572570
copyDatabase("GeoLite2-City-Test.mmdb", geoipTmpDir);

0 commit comments

Comments
 (0)