-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Allow REST tests to run in MP mode #126906
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
Conversation
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.
At some point in the future, we won't need this class anymore. But until we make the required gradle and CI changes, we still need these classes to run MP suites.
A question for my understanding, it is a bit unclear to me what we're going for here. Do we want to run all rest yaml tests or all rest ITs (or both) to run by default in MP-mode, i.e., with more than one project in the cluster? And if so, we want that to be the only mode of running those rest yaml/ITs or in parallel to them? |
Rene suggested to use a separate gradle task, e.g. I am no Gradle expert. So it might be that not all of the above is feasible. It is also possible that the separate Gradle task internally uses system property as well. But overall I still feel it is better to start with the new Gradle task so that we have the overall framework in place first before optimizing the downstream usages. |
Thanks for your input, @ywangd! I indeed assumed the gradle task would make use of a system property (or something similar) but my knowledge of gradle is very limited - I also didn't know |
The seperate gradle test task would just be a thin layer on top and pass a system property to the test suite to enable the MP mode. the benefit of having that done in a dedicated task (e.g. javaRestTestMP) would be that
For having that dedicated gradle task added I would want to have this work merged first: #126341 But with this PR here you should be already able to run MP only suites that we also wanna support afair (test subprojects that contain only MP related tests and running in non mp mode wouldn't make any sense) |
The dedicated Gradle task itself, as an entry point, can be kept simple. I was hoping there could be an additional shared Gradle logic so that enabling MP mode is handled outside of Does it sound plausible? |
@breskeby do you see any reason not to try to move the enabling of MP mode to a |
Pinging @elastic/es-delivery (Team:Delivery) |
I've just marked this PR as "ready for review". I added a @ywangd I don't know if this is exactly what you had in mind, but it still requires a system property to make things work. Since that's the same approach we use for FIPS, I figured there's at least some precedent. What do you think? |
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 working on this. The addition of MultiProjectEnabledClusterConfigProvider
looks good to me. It is simpler than a complete new specBuilder. It's fine to depend a system propery. The system property may come from the dedicate Gradle task in the future. For now, it is OK to explicitly specify it. I'd prefer logics in ESRestTestCase
do not depend on it though because it can be queried from the cluster itself, either through the testCluster interface or REST requests/responses with the actual cluster.
I suggest we make this PR focus on changes to the TestCluster and the MP yaml tests (simply by passing the new system property as a test to show it works). It is easier to review especially since we need Rene's approval on test cluster changes.
I prefer leaving changes to ESRestTestCase
to a separate PR because I'd like to see it handles more generally between cluster with test-mp plugin and the serverless-mp plugin. It's better iterated with its own PR.
We can also leave the MP-only tests to a separate PR. What I have in mind is that they should be placed under a javaRestTestMp
folder which automatically triggers the new Gradle task that specifies the system property for us. Existing tests in javaRestTest
folder will see two Gradle tasks, one as is and a new opt-in one with MP enabled.
This PR is still linked with the serverless PR. I think we should unlink them. The serverless side can use a similiar configProvider for ServerlessLocalClusterSpecBuilder
. I think a separate PR for this change (plus using it for the serverless side's MP yaml tests) would be preferable as well.
.../java/org/elasticsearch/multiproject/test/CoreWithMultipleProjectsClientYamlTestSuiteIT.java
Outdated
Show resolved
Hide resolved
How would that work exactly? You mentioned
I'm not sure I follow why you want to split up this PR. My reason for combining things this way is that I eliminated all duplicate configuration, and make everything configure MP tests in the same way. That way, it's more clear in next steps what we need to change (and where). I like your suggestion of With my current changes, we need to make some changes in serverless too, to align the way MP mode is enabled (otherwise tests fail). I agree that creating a dedicated config provider in serverless should be done in a follow-up PR. |
@breskeby could you have a look at this when you have time? Yang and I discussed this over Zoom today and we're in agreement with the current approach. There are some next steps to this of course, but we'll start tackling them after this PR. I just tested (again) and with the changes in this PR I am able to run java REST tests in MP mode simply by passing the system property |
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.
LGTM
Please want to get approval from @breskeby as well. Thanks!
@@ -26,6 +26,7 @@ public class XpackWithMultipleProjectsClientYamlTestSuiteIT extends MultipleProj | |||
public static ElasticsearchCluster cluster = ElasticsearchCluster.local() | |||
.distribution(DistributionType.DEFAULT) | |||
.name("yamlRestTest") | |||
.module("test-multi-project") |
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.
Nit: This is not necessary since the distribution is DEFAULT, i.e. all modules are included.
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.
do we pick DEFAULT here purposly? or would INTEG_TEST be enough?
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.
This configuration is copied from XPackRestIT
. Since this test suite is a collection of a lot of different x-pack features (I think we still want to split those tests up, but that's unrelated to MP), these tests will need most x-pack modules. I don't think we'd save a lot by converting this to INTEG_TEST
.
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.
Lgtm in general. nothing from blocking. left just a few questions regarding DEFAULT distro vs. INTEG_TEST
@@ -46,7 +45,6 @@ public class IndexMultiProjectCRUDIT extends MultiProjectRestTestCase { | |||
private static ElasticsearchCluster createCluster() { | |||
LocalClusterSpecBuilder<ElasticsearchCluster> clusterBuilder = ElasticsearchCluster.local() | |||
.nodes(NODE_NUM) | |||
.distribution(DistributionType.INTEG_TEST) // TODO multi-project: make this test suite work under the default distrib |
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.
Why was that changed? Using DEFAULT is build wise quite more expensive to run as it requires all plugins and modules to be build as part of this. In general we should aim to use the INTEG_TEST distribution where possible. If there's any convenience we can add to make that easier, lets do that.
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.
Tbh, I mainly removed it because of the TODO and the tests passed. I'll revert the changes and remove the comments.
The DistributionType
names are unintuitive to me. I asked about this in #es-elivery a few days ago so now I understand what the difference is why we actually want INTEG_TEST
. I think a first step to make people move away from DEFAULT
to INTEG_TEST
is to rename the values. DEFAULT
could maybe be ALL_MODULES
with a JavaDoc explaining why you shouldn't use that. Then INTEG_TEST
could maybe be DEFAULT
with a JavaDoc explaining that you need to add modules yourself (plus an explanation why we want people to use the latter). These are just suggestions, my point is that not wanting people to use something called DEFAULT
without any docs (except for an email that people like me might have missed) is a bit confusing.
Mainly moves project setup from
MultipleProjectsClientYamlSuiteTestCase
toESRestTestCase
. This allows both Java REST tests and YAML tests to be runin MP mode. This PR makes use of a simple system property to toggle the behavior.
Future work will add the required gradle changes to be able to run any REST test in
MP mode more easily.