[Security Solution][Detection Engine] Fix enrichment tests for Entity Store V2 on MKI#271093
[Security Solution][Detection Engine] Fix enrichment tests for Entity Store V2 on MKI#271093abhishekbhatia1710 wants to merge 24 commits into
Conversation
|
Pinging @elastic/security-entity-analytics (Team:Entity Analytics) |
71ba1f9 to
18dfcbc
Compare
|
I think we should remove the check for V1 vs V2, remove the feature flag override and just update the tests for V2 entity store, WDTY? |
|
Done @ymao1 ! Removed the |
|
I think we can try to remove the x-pack/solutions/security/test/security_solution_api_integration/config/ess/config.base.ts and then in the test files, where a test is tagged |
|
The failures in the current build are in the `with host risk index` / `alerts enrichment` describe blocks across EQL, ES|QL, indicator match, new terms, query, and threshold — exactly the blocks where we removed the V1 fallback. On `@ess` and `@serverless` (non-MKI) environments, `entityStoreV2.setup()` is throwing because Entity Store V2 isn't available there. Worth noting: builds 447589 and 447911 (original code, with the V1 fallback still in place) also failed, so these tests were already broken on ESS even before the refactor. A few options for how to proceed — happy to go whichever direction you prefer:
WDYT? |
This should be resolved when we remove the global feature flag as suggested here #271093 (comment) right? We were deliberately disabling the V2 entity store in these configs before but now that we're relying on entity store V2, we should remove that |
…rate indicator_match_alert_suppression enrichment tests to V2
|
Actionable comments posted: 0 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (14)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughThis PR removes the experimental feature gate Suggested labels
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
rylnd
left a comment
There was a problem hiding this comment.
I had a few comments about the new v2 test service.
Also: I don't see any code related to the "fallback" behavior outlined in the PR description. Am I missing something?
Hi @rylnd, thanks for your review! The original PR description mentioned a fallback to legacy esArchiver archives when V2 was disabled, but that code no longer exists. I updated the PR description to remove that reference. The current implementation always uses Entity Store V2 directly (no fallback). The CI failures we were seeing turned out to be caused by missing entity.id on user entities (the create API requires it explicitly, it cannot auto-derive the EUID from user.name alone), which is now fixed. |
… aggregate by host.name
…at alerts with host.id
…ce condition in entity store ready check
💔 Build Failed
Failed CI Steps
Test Failures
Metrics [docs]
History
|
rylnd
left a comment
There was a problem hiding this comment.
LGTM once the current CI is green!
… race condition Two root causes addressed for continuous CI failures in build 450343: 1. **"before all" hook failures** (Indicator Match elastic#58/elastic#204, Query Rule elastic#26/elastic#28): The setup was only returning `false` for HTTP 404/503 from the install API. Any other non-success status (e.g. 403, 400) caused it to throw, crashing the `before all` hook in non-MKI serverless environments. Fix: return `false` for ANY non-200/201 status code. 2. **Assertion failures due to race condition** (ML elastic#45/elastic#170, EQL suppression elastic#96/elastic#205, New Terms elastic#23/elastic#68): The previous commit changed `waitForWithTimeout` to accept `running || stopped`. This allowed entity seeding to happen while the initial engine scan was still `running`, causing the engine to overwrite test entities before the detection rule executed. Fix: revert to waiting strictly for `stopped`, and catch timeouts gracefully (returning `false` to skip rather than crashing).
Summary
Closes https://github.com/elastic/security-team/issues/17408 (internal)
Detection engine enrichment tests were failing on MKI (`@serverlessQA`) because they relied on legacy V1 risk-score and asset-criticality indices absent when Entity Store V2 is enabled.
This PR fixes all affected enrichment tests by using Entity Store V2 to seed the required entities.
What changed
Approach
On all environments (ESS, serverless, MKI), entities are seeded directly into Entity Store V2 using the correct EUID:
Supersedes the skip-based approach in #270974 with a proper fix.
Builds on the approach started in #270939 by @denar50.