-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] improve endpoint metadata tests #125883
Conversation
2588402
to
0212418
Compare
before(async () => { | ||
// create role/user | ||
await createUserAndRole(getService, ROLES.t1_analyst); | ||
loadedData = await endpointTestResources.loadEndpointData(); |
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.
since we're only testing for 403s here, the data load seems unnecessary.
Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt) |
6d4217f
to
12f2b74
Compare
await this.waitForEndpoints(indexedData.hosts.map((host) => host.agent.id)); | ||
const metadataIds = Array.from(new Set(indexedData.hosts.map((host) => host.agent.id))); | ||
await this.waitForEndpoints(metadataIds, waitTimeout); | ||
await this.startTransform(METADATA_UNITED_TRANSFORM); |
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.
If I follow what is going on here correctly, you seem to be missing a .startTransform()
at the end of this entire function, since you immediately stopped the transform when this function executes. If waitUntilTransformed
is false
, then you never restart the transform.
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.
ah yes, good catch. will fix.
@@ -23,7 +23,7 @@ import { wrapErrorAndRejectPromise } from './utils'; | |||
const defaultFleetAgentGenerator = new FleetAgentGenerator(); | |||
|
|||
export interface IndexedFleetAgentResponse { | |||
agents: Agent[]; | |||
agents: Array<Agent & FleetServerAgent>; |
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 did you have to add FleetServerAgent
here?
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.
Agent
type doesn't contain the agent
field which FleetServerAgent
does. United transform uses the agent.id
field to join on so it's required. Agent
type is actually what the fleet agents endpoint is currently typed to return but it actually does also contain the agent
field. My guess is that when we asked fleet team to add agent.id
to the index for the united transform recently, this api's return type wasn't updated since we were the only ones using the new field and it was via transform.
Ideally, I think we also update the api's return type but that is fleet code so I didn't want to scope creep this PR. I think it'd be best for that to be its own PR since it's potentially going to end up needing other changes.
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.
Ahh. Ok. thanks for that explanation. I would suggest asking the Fleet team about this and then creating an issue to track the update if they are good with it.
63b9eab
to
c3b2f32
Compare
f250a15
to
60969bf
Compare
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.
Ran the tests locally. I left some nits and suggestions but otherwise good to 🚢
improve accuracy of endpoint metadata functional tests by waiting on metadata_united index instead of metadata_current index
60969bf
to
f669de0
Compare
@elasticmachine merge upstream |
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.
Approving, but did leave a few questions (optional)
@@ -23,7 +23,7 @@ import { wrapErrorAndRejectPromise } from './utils'; | |||
const defaultFleetAgentGenerator = new FleetAgentGenerator(); | |||
|
|||
export interface IndexedFleetAgentResponse { | |||
agents: Agent[]; | |||
agents: Array<Agent & FleetServerAgent>; |
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.
Ahh. Ok. thanks for that explanation. I would suggest asking the Fleet team about this and then creating an issue to track the update if they are good with it.
transform_id: `${transformId}*`, | ||
}); | ||
return Promise.all( | ||
transformsResponse.transforms.map((transform) => { |
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 assume the number of transforms here is small and thus we don't need to throttle the calls to *.startTranform()
- right?
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.
Yep. We control these transforms and it's only 2 so no worries there.
@elasticmachine merge upstream |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
17 similar comments
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 1ea3fc6) # Conflicts: # x-pack/test/security_solution_endpoint/services/endpoint.ts # x-pack/test/security_solution_endpoint_api_int/apis/endpoint_authz.ts # x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 1ea3fc6) # Conflicts: # x-pack/test/security_solution_endpoint/services/endpoint.ts # x-pack/test/security_solution_endpoint_api_int/apis/endpoint_authz.ts # x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
2 similar comments
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Summary
Update
EndpointTestResouces.loadEndpointData
to additionally handlemetadata_united
index. This should improve test accuracy as endpoint list is based on the united index now.flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/170https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/173https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/618
For maintainers