Skip to content
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

[Epic] Knowledge Base - API integration tests (#8737) #197290

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

e40pud
Copy link
Contributor

@e40pud e40pud commented Oct 22, 2024

Summary

This is a followup to the main Knowledge Base changes where we've:

  1. Fixed the issue with access control to KB entries via bulk actions APIs
  2. Added the RBAC validation for the bulk actions API
  3. Added integration tests to cover the bulk actions API

Checklist

Delete any items that are not applicable to this PR.

@e40pud e40pud added release_note:skip Skip the PR/issue when compiling release notes v9.0.0 Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:Security Assistant Security Assistant Team:Security Generative AI Security Generative AI v8.16.0 labels Oct 22, 2024
@e40pud e40pud self-assigned this Oct 22, 2024
@e40pud e40pud requested a review from a team as a code owner October 22, 2024 15:47
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@@ -117,8 +117,13 @@ export class DocumentsDataWriter implements DocumentsDataWriter {
{
bool: {
must_not: {
exists: {
field: 'users',
nested: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since users field is nested we should use that in the query otherwise it does nothing.

@@ -241,9 +294,10 @@ export const bulkActionKnowledgeBaseEntriesRoute = (router: ElasticAssistantPlug

return buildBulkResponse(response, {
// @ts-ignore-next-line TS2322
updated: docsUpdated,
updated: transformESToKnowledgeBase(docsUpdated),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema expectation is to return updated as an array of KnowledgeBaseEntryResponse, so we need to do this transformation.

@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner October 22, 2024 16:19
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7208

[✅] x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/trial_license_complete_tier/configs/ess.config.ts: 100/100 tests passed.
[✅] x-pack/test/security_solution_api_integration/test_suites/genai/knowledge_base/entries/trial_license_complete_tier/configs/serverless.config.ts: 100/100 tests passed.

see run history

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 22, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] test/functional/apps/discover/group3/config.ts / discover/group3 discover lens vis should be able to load a saved search with custom vis, edit vis and revert changes
  • [job] [logs] test/functional/apps/discover/group3/config.ts / discover/group3 discover lens vis should be able to load a saved search with custom vis, edit vis and revert changes

Metrics [docs]

✅ unchanged

History

cc @e40pud

@e40pud e40pud merged commit fd53861 into elastic:main Oct 23, 2024
38 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.16, 8.x

https://github.com/elastic/kibana/actions/runs/11487198124

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 23, 2024
…#197290)

## Summary

This is a followup to the main Knowledge Base changes where we've:
1. Fixed the issue with access control to KB entries via bulk actions
APIs
2. Added the RBAC validation for the bulk actions API
3. Added integration tests to cover the bulk actions API

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- Genai KB integration tests: [100 ESS + 100
Serverless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7208)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit fd53861)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.16 Backport failed because of merge conflicts
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 197290

Questions ?

Please refer to the Backport tool documentation

e40pud added a commit to e40pud/kibana that referenced this pull request Oct 23, 2024
…#197290)

## Summary

This is a followup to the main Knowledge Base changes where we've:
1. Fixed the issue with access control to KB entries via bulk actions
APIs
2. Added the RBAC validation for the bulk actions API
3. Added integration tests to cover the bulk actions API

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- Genai KB integration tests: [100 ESS + 100
Serverless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7208)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit fd53861)

# Conflicts:
#	x-pack/test/security_solution_api_integration/tsconfig.json
@e40pud
Copy link
Contributor Author

e40pud commented Oct 23, 2024

💚 All backports created successfully

Status Branch Result
8.16

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 23, 2024
…#197525)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Epic] Knowledge Base - API integration tests (#8737)
(#197290)](#197290)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-23T19:58:09Z","message":"[Epic]
Knowledge Base - API integration tests (#8737) (#197290)\n\n##
Summary\r\n\r\nThis is a followup to the main Knowledge Base changes
where we've:\r\n1. Fixed the issue with access control to KB entries via
bulk actions\r\nAPIs\r\n2. Added the RBAC validation for the bulk
actions API\r\n3. Added integration tests to cover the bulk actions
API\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- Genai KB integration tests: [100
ESS +
100\r\nServerless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7208)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"fd538614631c85c7cd3580e7d3270b9d38c57713","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","backport:prev-minor","Feature:Security
Assistant","Team:Security Generative AI","v8.16.0"],"title":"[Epic]
Knowledge Base - API integration tests
(#8737)","number":197290,"url":"https://github.com/elastic/kibana/pull/197290","mergeCommit":{"message":"[Epic]
Knowledge Base - API integration tests (#8737) (#197290)\n\n##
Summary\r\n\r\nThis is a followup to the main Knowledge Base changes
where we've:\r\n1. Fixed the issue with access control to KB entries via
bulk actions\r\nAPIs\r\n2. Added the RBAC validation for the bulk
actions API\r\n3. Added integration tests to cover the bulk actions
API\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- Genai KB integration tests: [100
ESS +
100\r\nServerless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7208)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"fd538614631c85c7cd3580e7d3270b9d38c57713"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197290","number":197290,"mergeCommit":{"message":"[Epic]
Knowledge Base - API integration tests (#8737) (#197290)\n\n##
Summary\r\n\r\nThis is a followup to the main Knowledge Base changes
where we've:\r\n1. Fixed the issue with access control to KB entries via
bulk actions\r\nAPIs\r\n2. Added the RBAC validation for the bulk
actions API\r\n3. Added integration tests to cover the bulk actions
API\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- Genai KB integration tests: [100
ESS +
100\r\nServerless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7208)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"fd538614631c85c7cd3580e7d3270b9d38c57713"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ievgen Sorokopud <[email protected]>
e40pud added a commit that referenced this pull request Oct 23, 2024
#197528)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[Epic] Knowledge Base - API integration tests (#8737)
(#197290)](#197290)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-23T19:58:09Z","message":"[Epic]
Knowledge Base - API integration tests (#8737) (#197290)\n\n##
Summary\r\n\r\nThis is a followup to the main Knowledge Base changes
where we've:\r\n1. Fixed the issue with access control to KB entries via
bulk actions\r\nAPIs\r\n2. Added the RBAC validation for the bulk
actions API\r\n3. Added integration tests to cover the bulk actions
API\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- Genai KB integration tests: [100
ESS +
100\r\nServerless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7208)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"fd538614631c85c7cd3580e7d3270b9d38c57713","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","backport:prev-minor","Feature:Security
Assistant","Team:Security Generative
AI","v8.16.0"],"number":197290,"url":"https://github.com/elastic/kibana/pull/197290","mergeCommit":{"message":"[Epic]
Knowledge Base - API integration tests (#8737) (#197290)\n\n##
Summary\r\n\r\nThis is a followup to the main Knowledge Base changes
where we've:\r\n1. Fixed the issue with access control to KB entries via
bulk actions\r\nAPIs\r\n2. Added the RBAC validation for the bulk
actions API\r\n3. Added integration tests to cover the bulk actions
API\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- Genai KB integration tests: [100
ESS +
100\r\nServerless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7208)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"fd538614631c85c7cd3580e7d3270b9d38c57713"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197290","number":197290,"mergeCommit":{"message":"[Epic]
Knowledge Base - API integration tests (#8737) (#197290)\n\n##
Summary\r\n\r\nThis is a followup to the main Knowledge Base changes
where we've:\r\n1. Fixed the issue with access control to KB entries via
bulk actions\r\nAPIs\r\n2. Added the RBAC validation for the bulk
actions API\r\n3. Added integration tests to cover the bulk actions
API\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- Genai KB integration tests: [100
ESS +
100\r\nServerless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7208)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"fd538614631c85c7cd3580e7d3270b9d38c57713"}},{"branch":"8.16","label":"v8.16.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"url":"https://github.com/elastic/kibana/pull/197525","number":197525,"branch":"8.x","state":"OPEN"}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:Security Assistant Security Assistant release_note:skip Skip the PR/issue when compiling release notes Team:Security Generative AI Security Generative AI Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.16.0 v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants