-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Run GeoIp YAML tests in multi-project cluster and fix bug discovered by tests #131521
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
Merged
samxbr
merged 27 commits into
elastic:main
from
samxbr:feature/multi-project/geoip-yaml-tests
Aug 1, 2025
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
17b4038
Run GeoIp yaml tests in multi-project cluster
samxbr 1f9ab3c
[CI] Auto commit changes from spotless
17a144c
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr e3a9314
minor
samxbr 4ed662e
Use ProjectState
samxbr 20955aa
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr 5f651a3
share yaml test code WIP
samxbr d4a08b3
use projectState.cluster()
samxbr 92935c8
Revert "share yaml test code WIP"
samxbr 348494c
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr ee11eba
share test code
samxbr 9accd8e
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr 0fdf1b0
remove unncessary plugin
samxbr d2c338c
remove clusterState
samxbr c611574
fix
samxbr 31fca85
Add FixForMultiProject and other fix
samxbr 4953636
[CI] Auto commit changes from spotless
892d97d
fix doc
samxbr e281e0a
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr 24cd03c
Remove NotMultiProjectCapable
samxbr 14f0284
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr 1287fdc
[CI] Auto commit changes from spotless
743602e
Add reminder to remove test
samxbr 7089827
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr f02df24
comment
samxbr ce80bbb
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr d0e8e31
Merge branch 'main' into feature/multi-project/geoip-yaml-tests
samxbr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...est/java/org/elasticsearch/ingest/geoip/IngestGeoIpClientMultiProjectYamlTestSuiteIT.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.ingest.geoip; | ||
|
||
import fixture.geoip.GeoIpHttpFixture; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.Name; | ||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; | ||
|
||
import org.elasticsearch.core.Booleans; | ||
import org.elasticsearch.core.FixForMultiProject; | ||
import org.elasticsearch.multiproject.test.MultipleProjectsClientYamlSuiteTestCase; | ||
import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; | ||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; | ||
import org.junit.Before; | ||
import org.junit.ClassRule; | ||
import org.junit.rules.RuleChain; | ||
import org.junit.rules.TestRule; | ||
|
||
import static org.elasticsearch.ingest.geoip.IngestGeoIpClientYamlTestSuiteIT.assertDatabasesLoaded; | ||
import static org.elasticsearch.ingest.geoip.IngestGeoIpClientYamlTestSuiteIT.putGeoipPipeline; | ||
|
||
@FixForMultiProject(description = "Potentially remove this test after https://elasticco.atlassian.net/browse/ES-12094 is implemented") | ||
public class IngestGeoIpClientMultiProjectYamlTestSuiteIT extends MultipleProjectsClientYamlSuiteTestCase { | ||
|
||
private static final boolean useFixture = Booleans.parseBoolean(System.getProperty("geoip_use_service", "false")) == false; | ||
|
||
private static GeoIpHttpFixture fixture = new GeoIpHttpFixture(useFixture); | ||
|
||
private static ElasticsearchCluster cluster = ElasticsearchCluster.local() | ||
.module("reindex") | ||
.module("ingest-geoip") | ||
.systemProperty("ingest.geoip.downloader.enabled.default", "true") | ||
// sets the plain (geoip.elastic.co) downloader endpoint, which is used in these tests | ||
.setting("ingest.geoip.downloader.endpoint", () -> fixture.getAddress(), s -> useFixture) | ||
// also sets the enterprise downloader maxmind endpoint, to make sure we do not accidentally hit the real endpoint from tests | ||
// note: it's not important that the downloading actually work at this point -- the rest tests (so far) don't exercise | ||
// the downloading code because of license reasons -- but if they did, then it would be important that we're hitting a fixture | ||
.systemProperty("ingest.geoip.downloader.maxmind.endpoint.default", () -> fixture.getAddress(), s -> useFixture) | ||
.setting("test.multi_project.enabled", "true") | ||
.setting("xpack.license.self_generated.type", "trial") | ||
.user(USER, PASS) | ||
.build(); | ||
|
||
@ClassRule | ||
public static TestRule ruleChain = RuleChain.outerRule(fixture).around(cluster); | ||
|
||
@Override | ||
protected String getTestRestCluster() { | ||
return cluster.getHttpAddresses(); | ||
} | ||
|
||
public IngestGeoIpClientMultiProjectYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) { | ||
super(testCandidate); | ||
} | ||
|
||
@ParametersFactory | ||
public static Iterable<Object[]> parameters() throws Exception { | ||
return ESClientYamlSuiteTestCase.createParameters(); | ||
} | ||
|
||
@Before | ||
public void waitForDatabases() throws Exception { | ||
putGeoipPipeline("pipeline-with-geoip"); | ||
assertDatabasesLoaded(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment about commoning up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reused code from |
||
} |
nielsbauman marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably missing something, but I'm having trouble identifying why we need this dedicated YAML test suite. Can you explain why we can't just run the regular YAML suite in MP mode (i.e.
tests.multi_project.enabled=true
)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we'd want to run the yaml tests in both MP enabled and disabled mode, is there a way to do that with the existing test suite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100% agree on that
Once ES-12094 gets implemented, that should be trivial. However, I'm not familiar enough with Gradle to know if there's a simple way to do that right now. Perhaps you can ask in
#es-delivery
- mainly for an answer to this question and potentially also a status update on the ticket itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing the issue. Until that is implemented, I think keeping the MP YAML tests in
qa/multi-project
Gradle project together with other MP Java rest tests is more organized.Also asked in the linked Slack channel to see if there's better way of doing this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for asking in the channel. If we don't find a better way to do it, I think I'd be more in favor of not running the MP YAML tests in the CI yet. I don't think these changes are that small and especially if we're combining them with the fix itself, it'll be annoying to revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, leaving the MP YAML tests out of CI seems missing test coverage, considering the amount of code change have been made to make GeoIP project-aware (especially there's already a bug found from these tests). Although MP is not in use yet, so probably not a huge due if there's bug.
Why do we want to revert? If these tests fail in CI then they should be muted, and we can fix them instead of reverting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we're missing test coverage if we don't run this GeoIP YAML suite in MP mode, but there are other suites that we're not covering yet either, and, most importantly, we're not close to running any of this in production. So, I think we can live without coverage a little longer.
Once the Jira ticket I linked gets implemented, all these changes become redundant, and we can just do something like
or whatever the gradle lines will look like to make a YAML test suite run in MP mode as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, I have added a
FixForMultiProject
as reminder. For this specific PR, I think there's value including the tests suite as it validates the bug has been fixed. We can always remove it after the linked ticket is implemented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the annotation. I still don't really think it's worth merging these changes, but I also don't think it's worth discussing this any longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Niels, really appreciate your thought on this. I also don't think it's worth spending more time discussing on this. I agree that this YAML test change is not effortless, we can defer making similar changes for other modules until ES-12094 is implemented.