Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GeoIpDownloaderIT.testInvalidTimestamp more robust #75330

Merged
merged 3 commits into from
Jul 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
Expand Down Expand Up @@ -167,6 +168,21 @@ public void testInvalidTimestamp() throws Exception {
assertFalse(result.getIngestDocument().hasField("ip-asn"));
assertFalse(result.getIngestDocument().hasField("ip-country"));
});
settingsResponse =
client().admin().cluster()
.prepareUpdateSettings()
.setPersistentSettings(Settings.builder()
.put("ingest.geoip.database_validity", (String) null))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit:

Suggested change
.put("ingest.geoip.database_validity", (String) null))
.putNull("ingest.geoip.database_validity")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I haven't seen that method before, I've update it in other places in this test as well

.get();
assertTrue(settingsResponse.isAcknowledged());
assertBusy(() -> {
for (Path geoIpTmpDir : geoIpTmpDirs) {
try (Stream<Path> files = Files.list(geoIpTmpDir)) {
Set<String> names = files.map(f -> f.getFileName().toString()).collect(Collectors.toSet());
assertThat(names, hasItems("GeoLite2-ASN.mmdb","GeoLite2-City.mmdb","GeoLite2-Country.mmdb"));
}
}
});
}

public void testUpdatedTimestamp() throws Exception {
Expand Down