-
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
[Discover] Add support for contextual awareness functional tests #185905
[Discover] Add support for contextual awareness functional tests #185905
Conversation
/ci |
ec06e14
to
831f324
Compare
/ci |
/ci |
/ci |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#6304[✅] test/functional/apps/discover/context_awareness/config.ts: 50/50 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#6307[✅] x-pack/test_serverless/functional/test_suites/security/config.context_awareness.ts: 50/50 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#6305[✅] x-pack/test_serverless/functional/test_suites/observability/config.context_awareness.ts: 50/50 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#6306[✅] x-pack/test_serverless/functional/test_suites/search/config.context_awareness.ts: 50/50 tests passed. |
/ci |
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
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 👍
src/plugins/discover/public/context_awareness/__mocks__/index.ts
Outdated
Show resolved
Hide resolved
@davismcphee I just finished a first pass on the changes at a high-level, here some thoughts:
|
Thanks for the review @tonyghiani, and some responses to your feedback:
Neat, I actually didn't realize you could use The example data should be very simple and predictable, not reflective of real world data, to make it easy to assert against specific index names, field contents, etc. I'm sure we could do this with
The intent isn't to have all profiles enabled through The reason we want this setting other than for example profiles is so that we can merge incomplete or experimental profiles to
We discussed just hardcoding them to be enabled when passing
Personally I think a dedicated service for this would be overkill, but I agree that the handling of profiles was starting to get messy. I revisited this and realized we actually don't need |
@davismcphee I see your point, I guess it would be useful to then have some sort of guidance on how to use this (I think you mentioned you had a follow-up PR for documentation). I'll continue the PR review and leave the previous points to your judgment, I feel |
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 👌
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.
small questions/comments
it('should render custom @timestamp but not custom log.level', async () => { | ||
const state = kbnRison.encode({ | ||
dataSource: { type: 'esql' }, | ||
query: { esql: 'from my-example-* | sort @timestamp desc' }, |
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 have question for my clarity. Even though my-example-*
includes my-example-logs
as an index, why log.level
is not customized 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.
Good question, it's just due to the way the resolution logic for the example profile that customizes log.level
is implemented here:
Lines 62 to 64 in 07a26a8
if (indexPattern !== 'my-example-logs') { | |
return { isMatch: false }; | |
} |
We're only matching on this profile if the index pattern exactly equals my-example-logs
, although it could have been implemented to match on any index pattern covered by my-example-*
if I had decided to implement it that way. Real resolution implementations like the logs one are more sophisticated, this one is pretty dumb just for example purposes.
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... I went though these example profile multiple time but missed this line. Sorry for that and thank you very much for pointing it out.
Real resolution implementations like the logs one are more sophisticated, this one is pretty dumb just for example purposes.
Makes sense to me now. This demonstrates the profile resolutions well enough. Thanks.
const level = getFieldValue(props.row, 'log.level'); | ||
|
||
if (!level) { | ||
return <span css={{ color: euiThemeVars.euiTextSubduedColor }}>(None)</span>; |
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 suggest to add data-test-subj
here as well, since this is also a customized renderer and not the original one.
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.
Makes sense to me, added here: de21734
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.
@davismcphee I see your point, I guess it would be useful to then have some sort of guidance on how to use this (I think you mentioned you had a follow-up PR for documentation).
Definitely it would be, and I do intend to add documentation and will make sure to cover this since I understand it's currently confusing for others. Just a matter of finding some time between trying to get things ready for next week's demo 😅 It's ON Week for us next week and I'm on PTO the following week, but I will aim to address this ASAP.
I feel
synthtrace
should be the way to go for new tests as it makes it much easier to iterate the tests and update the mock data
Fully agree, it's a better way for sure, and I appreciate the understanding. Now that I know how to use it for FTs, we should absolutely use it at least for testing real profile implementations, and I will see if I can find some time to come back and update these example tests to use it too.
const level = getFieldValue(props.row, 'log.level'); | ||
|
||
if (!level) { | ||
return <span css={{ color: euiThemeVars.euiTextSubduedColor }}>(None)</span>; |
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.
Makes sense to me, added here: de21734
it('should render custom @timestamp but not custom log.level', async () => { | ||
const state = kbnRison.encode({ | ||
dataSource: { type: 'esql' }, | ||
query: { esql: 'from my-example-* | sort @timestamp desc' }, |
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.
Good question, it's just due to the way the resolution logic for the example profile that customizes log.level
is implemented here:
Lines 62 to 64 in 07a26a8
if (indexPattern !== 'my-example-logs') { | |
return { isMatch: false }; | |
} |
We're only matching on this profile if the index pattern exactly equals my-example-logs
, although it could have been implemented to match on any index pattern covered by my-example-*
if I had decided to implement it that way. Real resolution implementations like the logs one are more sophisticated, this one is pretty dumb just for example purposes.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @davismcphee |
Summary
This PR adds functional test support for the Discover contextual awareness framework, and adds tests for the initial
getCellRenderers
extension point using example profiles.To support this, this PR introduces a new YAML setting called
discover.experimental.enabledProfiles
which can be used to selectively enable profiles both for functional testing and demoing WIP profiles that aren't yet ready for GA.Example usage:
Flaky test runs:
Resolves #184699.
Checklist
For maintainers