-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Get node ID from nodes info in REST tests #40052
Get node ID from nodes info in REST tests #40052
Conversation
We discussed recently that the cluster state API should be considered "internal" and therefore our usual cast-iron stability guarantees do not hold for this API. However, there are a good number of REST tests that need to identify the master node. Today they call `GET /_cluster/state` API and extract the master node ID from the response. An alternative that avoids the unstable cluster state API is to call `GET _nodes/_master`: the master node ID is the unique key in the `nodes` map in the response. This change adds the ability for YAML-based REST tests to extract the unique key of a singleton map so that they can obtain the master node ID from the nodes info API instead of the cluster state API.
Pinging @elastic/es-distributed |
Pinging @elastic/es-core-infra |
Do we plan on removing the master node info from the cluster state output? I understand that cluster state is not a stable API but I wonder if/why we need to stop using it everywhere in our own tests? I would prefer if it could be replaced without adding new features to the yaml test runner I guess. cc @elastic/es-clients |
No, there's no plan to remove anything else from the output @javanna. This PR arose out of a recent discussion about some another breaking change to the cluster state API (see #40061) and grew into a need to identify any users of this API and if possible to migrate them to an API that we could guarantee to be stable. As I see it, the choices for identifying the master node are either (a) carry on using the cluster state API, (b) add a whole new API endpoint just for this, or (c) adjust the test runner to support an alternative way to get the master node ID. I looked a bit harder at how the tests were using the master node ID, and in many cases we're just using it as an easy way to get an arbitrary node ID, with no real interest in whether it's the master or not. For instance in the shrink/split tests we do the shrink/split on the master because there doesn't seem to be an easy way to pick another node ID, although really we should be picking an arbitrary data node and not the master at all. Perhaps that's the missing feature in the test runner? |
Agreed, as far as I remember those tests just need any node. anybody @elastic/es-clients has a preference on how to move forward? |
I quite like this |
Hearing no objections, and at least some support, I think we should proceed with this. |
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 thanks @DaveCTurner . Shall we add a check that wherever we use the feature we also have a skip for it? We do it for other features in general to avoid breaking other runners tests without knowing.
I do like your suggestion to fail tests if we use |
heya @DaveCTurner would it be possible to add the check to |
I'm declaring this to be too complicated. The trouble with adding it to |
We discussed recently that the cluster state API should be considered "internal" and therefore our usual cast-iron stability guarantees do not hold for this API. However, there are a good number of REST tests that try to identify the master node. Today they call `GET /_cluster/state` API and extract the master node ID from the response. In fact many of these tests just want an arbitary node ID (or perhaps a data node ID) so an alternative is to call `GET _nodes` or `GET _nodes/data:true` and obtain a node ID from the keys of the `nodes` map in the response. This change adds the ability for YAML-based REST tests to extract an arbitrary key from a map so that they can obtain a node ID from the nodes info API instead of using the master node ID from the cluster state API. Relates elastic#40047.
We discussed recently that the cluster state API should be considered "internal" and therefore our usual cast-iron stability guarantees do not hold for this API. However, there are a good number of REST tests that try to identify the master node. Today they call `GET /_cluster/state` API and extract the master node ID from the response. In fact many of these tests just want an arbitary node ID (or perhaps a data node ID) so an alternative is to call `GET _nodes` or `GET _nodes/data:true` and obtain a node ID from the keys of the `nodes` map in the response. This change adds the ability for YAML-based REST tests to extract an arbitrary key from a map so that they can obtain a node ID from the nodes info API instead of using the master node ID from the cluster state API. Relates #40047.
We discussed recently that the cluster state API should be considered
"internal" and therefore our usual cast-iron stability guarantees do not hold
for this API.
However, there are a good number of REST tests that try to identify the master
node. Today they call
GET /_cluster/state
API and extract the master node IDfrom the response. In fact many of these tests just want an arbitary node ID
(or perhaps a data node ID) so an alternative is to call
GET _nodes
orGET _nodes/data:true
and obtain a node ID from the keys of thenodes
map in theresponse.
This change adds the ability for YAML-based REST tests to extract an arbitrary
key from a map so that they can obtain a node ID from the nodes info API
instead of using the master node ID from the cluster state API.
Relates #40047.