-
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
[Files] Tests for createEsFileClient()
usage when indexAsAlias
option and minor refactor
#153815
[Files] Tests for createEsFileClient()
usage when indexAsAlias
option and minor refactor
#153815
Conversation
…index-as-alias-change' into task/olm-files-plugin-tests-for-index-as-alias-change
it('should be an empty stream on empty response', async () => { | ||
client.get.mockResponseOnce(toReadable()); | ||
const onData = jest.fn(); | ||
describe('with `indexIsAlias` set to `false`', () => { |
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.
const { esClient, index, indexIsAlias } = this; | ||
let doc: FileDocument<M> | undefined; | ||
|
||
if (indexIsAlias) { |
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.
Removed fetchDoc()
utility since it was only being used here and moved the implementation here.
|
||
if (!doc) { | ||
this.logger.error(`File with id "${id}" not found`); | ||
this.logger.error( |
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.
@jloleysens - I think this addresses your comment in the prior PR. If .search()
does not find the doc, then it will throw an error here.
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
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! LGTM.
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
This PR builds on top of #153342 and:
indexAsAlias
option that was added tocreateEsFileClient()
fetchDoc()
utility (not needed)