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

Add GeoIP CLI integration test #71381

Merged
merged 2 commits into from
Apr 8, 2021
Merged

Conversation

probakowski
Copy link
Contributor

This change adds additional test to GeoIpDownloaderIT which tests that artifacts produces by GeoIP CLI tool can be consumed by cluster the same way as from our original service.
It does so by running the tool from fixture which then simply serves the generated files (this is exactly the way users are supposed to use the tool as well).

Relates to #68920

@probakowski probakowski added >test Issues or PRs that are addressing/adding tests :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v8.0.0 v7.13.0 labels Apr 6, 2021
@probakowski probakowski requested a review from martijnvg April 6, 2021 23:17
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Apr 6, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (Team:Core/Features)

@probakowski probakowski mentioned this pull request Apr 6, 2021
15 tasks
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

This looks good. I left a few questions.

@@ -59,6 +60,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;

@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST)
Copy link
Member

Choose a reason for hiding this comment

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

I think the test cluster can be reused? So this annotation can be removed?

@@ -72,7 +74,8 @@
protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
Settings.Builder settings = Settings.builder().put(super.nodeSettings(nodeOrdinal, otherSettings));
if (ENDPOINT != null) {
settings.put(GeoIpDownloader.ENDPOINT_SETTING.getKey(), ENDPOINT);
String endpoint = getTestName().endsWith("Cli") ? ENDPOINT + "cli/overview.json" : ENDPOINT;
Copy link
Member

Choose a reason for hiding this comment

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

maybe set/overwrite the custom endpoint for cli files in the testGeoIpDatabasesDownloadCli() test instead of here with a conditional? I think it is clearer to have this logic where it is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored CLI case to separate class so it's cleaner now

Path source = Path.of("source");
Files.createDirectory(source);

Path target = Path.of("target");
Copy link
Member

Choose a reason for hiding this comment

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

Do these paths end up in the build directory of the geoid-fixture module?
Otherwise perhaps we should create tmp dirs instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixtures are run inside docker container which is then discarded, I think we can get away with using current directory

@probakowski probakowski requested a review from martijnvg April 8, 2021 09:51
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

@probakowski probakowski merged commit 44a2ae4 into elastic:master Apr 8, 2021
@probakowski probakowski deleted the geoip-cli-test branch April 8, 2021 10:49
probakowski added a commit to probakowski/elasticsearch that referenced this pull request Apr 8, 2021
This change adds additional test to GeoIpDownloaderIT which tests that artifacts produces by GeoIP CLI tool can be consumed by cluster the same way as from our original service.
It does so by running the tool from fixture which then simply serves the generated files (this is exactly the way users are supposed to use the tool as well).

Relates to elastic#68920
# Conflicts:
#	test/fixtures/geoip-fixture/src/main/java/fixture/geoip/GeoIpHttpFixture.java
probakowski added a commit that referenced this pull request Apr 8, 2021
* Add GeoIP CLI integration test (#71381)

This change adds additional test to GeoIpDownloaderIT which tests that artifacts produces by GeoIP CLI tool can be consumed by cluster the same way as from our original service.
It does so by running the tool from fixture which then simply serves the generated files (this is exactly the way users are supposed to use the tool as well).

Relates to #68920
# Conflicts:
#	test/fixtures/geoip-fixture/src/main/java/fixture/geoip/GeoIpHttpFixture.java

* fix compilation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP Team:Data Management Meta label for data/management team >test Issues or PRs that are addressing/adding tests v7.13.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants