-
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][Serverless] Reusing Cypress tests for Serverless infrastructure #162698
Conversation
6dbef51
to
3eeb56b
Compare
3eeb56b
to
8836fdc
Compare
# Conflicts: # x-pack/plugins/security_solution/cypress/e2e/exceptions/alerts_table_flow/endpoint_exceptions.cy.ts # x-pack/plugins/security_solution/cypress/e2e/exceptions/alerts_table_flow/rule_exceptions/auto_populate_with_alert_data.cy.ts # x-pack/plugins/security_solution/cypress/e2e/exceptions/entry/comments.cy.ts
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 couldn't run Cypress tests locally for ESS.
I'm in x-pack/test/security_solution_cypress
, I run cypress:open:ess
. Then ES and Kibana start apparently successfully, after that it crashes with the following error, and the test runner doesn't start:
warn Failure loading service "security"
ERROR TimeoutError: Request timed out
at SniffingTransport.request (/Users/georgii/Code/elastic/kibana-pr1/node_modules/@elastic/transport/src/Transport.ts:584:17)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Security.putRole (/Users/georgii/Code/elastic/kibana-pr1/node_modules/@elastic/elasticsearch/src/api/api/security.ts:1391:12)
at ensureSystemIndicesUser (system_indices_user.ts:33:3)
at createSystemIndicesUser (system_indices_user.ts:78:3)
at SecurityServiceProvider (security.ts:32:3)
at provider_collection.ts:53:13
at async Promise.all (index 9)
at ProviderCollection.loadAll (provider_collection.ts:48:5)
at parallel.ts:347:13
at withProcRunner (with_proc_runner.ts:29:5)
at concurrency (parallel.ts:181:11)
at /Users/georgii/Code/elastic/kibana-pr1/node_modules/p-map/index.js:57:22
info [kibana] exited with null after 156.8 seconds
ERROR UNHANDLED ERROR
ERROR Error: Failure initializing 1 service(s)
at ProviderCollection.loadAll (provider_collection.ts:64:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at parallel.ts:347:13
at withProcRunner (with_proc_runner.ts:29:5)
at concurrency (parallel.ts:181:11)
at /Users/georgii/Code/elastic/kibana-pr1/node_modules/p-map/index.js:57:22
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I also noticed that you deleted the Cypress burn CI job, what was the reason for doing this?
- command: .buildkite/scripts/steps/functional/security_solution_burn.sh | ||
label: 'Security Solution Cypress tests, burning changed specs' | ||
agents: | ||
queue: n2-4-spot | ||
depends_on: build | ||
timeout_in_minutes: 120 | ||
parallelism: 1 | ||
soft_fail: true | ||
artifact_paths: | ||
- "target/kibana-security-solution/**/*" |
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 deleted? This job was just recently added by @patrykkopycinski to help us reveal flakiness
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.
As I changed all the files the execution was taking extremely long, cancel it was not helping either. The idea is to enable it again on a follow-up PR.
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.
Okay, sounds good 👍
} from '@kbn/security-solution-plugin/cypress/screens/security_header'; | ||
import { encode } from '@kbn/rison'; | ||
import { NEW_FEATURES_TOUR_STORAGE_KEYS } from '@kbn/security-solution-plugin/common/constants'; | ||
} from '../../../../test/security_solution_cypress/cypress/screens/security_header'; |
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.
This is a bit suspicious dependency from a plugin to test code outside of plugins. cc @PhilippeOberti
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.
The issue mentioned in #162698 (review) appeared to happen with a few folks who are on Intel-based Macs (internal slack thread). The suggested workaround is to run tests against manually started ES and Kibana instances (slack):
Hey, one workaround, it’s to run cypress tests agains you local es/kibana
So if you have es/kibana running locally, you can run cypress tests with this command
CYPRESS_CYPRESS_BASE_URL="http://elastic:changeme@localhost:5601/" CYPRESS_BASE_URL="http://elastic:changeme@localhost:5601/" CYPRESS_ELASTICSEARCH_URL="http://system_indices_superuser:changeme@localhost:9200/" CYPRESS_ELASTICSEARCH_USERNAME="system_indices_superuser" CYPRESS_ELASTICSEARCH_PASSWORD="changeme" baseUrl="http://elastic:changeme@localhost:5601/" BASE_URL="http://elastic:changeme@localhost:5601/" ELASTICSEARCH_URL="http://system_indices_superuser:changeme@localhost:9200/" ELASTICSEARCH_USERNAME="system_indices_superuser" ELASTICSEARCH_PASSWORD="changeme" ELASTICSEARCH_URL_WITH_AUTH="http://system_indices_superuser:changeme@localhost:9200/" FLEET_SERVER_URL="http://localhost:8220/" KIBANA_URL="http://localhost:5601/" KIBANA_URL_WITH_AUTH="http://elastic:changeme@localhost:5601/" KIBANA_USERNAME="elastic" KIBANA_PASSWORD="changeme" yarn cypress open --config-file ./cypress/cypress.config.ts
Also this command don’t work for me until I commented this in kibana.dev.yaml
# server.name: kibana
# server.host: "0.0.0.0"
I'll follow up in those threads to see if we can fix this.
I also added a few fixes to the branch addressing my previously posted comments.
Thank you @MadameSheema. Go reusable Cypress tests! 🤘 🤘
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.
change in 24da233 looks good! 👍
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
…infrastructure (elastic#162698) Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Patryk Kopycinski <[email protected]> Co-authored-by: Georgii Gorbachev <[email protected]>
## Summary closes: #157847 The new links and pages in Security Solution for Serverless: - `Investigations` - `Timelines` - `Osquery` - `Assets` - `Fleet` (and all its sub-links) - `Endpoints` (and all its sub-links) - `Cloud defend` (and all its sub-links) - Callout with button linking `Integrations` in Project Setting - `Project settings` - `Users & roles` (Cloud UI) - `Billing & consumption` (Cloud UI) - `Integrations` (link to integrations with _/browse/security_ path parameter) - `Entity risk score` (link currently under the `riskScoringRoutesEnabled` experimental flag) - `Management` accordion with a set of (stack) management categories and pages links Sections updated: (ESS & Serverless) `Rules` links have been updated according to new specs. (ESS) The `Settings` page was renamed back to `Manage`. (Serverless) The `Dev tools` link was moved to the bottom of the side navigation. #### Cypress tests for serverless: They will be implemented in a follow-up PR when the infrastructure is ready #162698 ## Screenshots ### Serverless Investigations: ![investigations](https://github.com/elastic/kibana/assets/17747913/19b602ab-53bb-4280-b0c3-dc69255ea3ab) ![investigations_panel](https://github.com/elastic/kibana/assets/17747913/8be036fc-6095-4234-8b07-1a7149c8a92b) Assets: ![assets](https://github.com/elastic/kibana/assets/17747913/963723d5-16da-45dd-955c-a7d7b61099e6) ![assets_panel](https://github.com/elastic/kibana/assets/17747913/977c0716-7cc3-4369-acdf-0787e264a912) Rules: ![rules](https://github.com/elastic/kibana/assets/17747913/5bafbd08-508c-4b50-bd28-dc052371e76a) ![rules_panel](https://github.com/elastic/kibana/assets/17747913/ea47f8d9-4b68-44f3-8a42-6f795d05b982) Project Settings: ![project_settings](https://github.com/elastic/kibana/assets/17747913/36dbb446-3354-4519-b59c-e8b5005fbb71) ![project_settings_panel](https://github.com/elastic/kibana/assets/17747913/1315b54b-4423-41a2-b0ed-997ee77c1f6d) ## ESS Side Navigation: ![ess_side_nav](https://github.com/elastic/kibana/assets/17747913/a3687a47-3ccb-4ce8-aa53-9e962a6ef1cf) --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Tomasz Ciecierski <[email protected]> Co-authored-by: Tomasz Ciecierski <[email protected]>
…infrastructure (#162698) Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Patryk Kopycinski <[email protected]> Co-authored-by: Georgii Gorbachev <[email protected]>
…s for Serverless (#165094) ## Summary - introduces tags for [Defend Workflows] cypress tests (similarly to #162698) - adds scripts to Security Solution: - `cypress:dw:serverless:open` and `:run` - `cypress:dw:endpoint:serverless:open` and `:run` - adds CI jobs to run these scripts - so far most of the expected tests got both `@serverless` and `@brokenInServerless` tests, because of other issues to be solved, - one test is able to run against serverless: `x-pack/plugins/security_solution/public/management/cypress/e2e/mocked_data/policy_details.cy.ts`
UPDATE!
x-pack/test/security_solution_cypress
folder in order to avoid circular dependency.AFTER MERGING THIS PR:
security_solution_cypress/cypress/e2e
folder of each specific team, and should be tagged just with@serverless
@brokenInServerless
, I can give support and advice.yarn cypress:open:ess
to develop and debug tests on ESS environmentyarn cypress:open:serverless
to develop and debug tests on FTR serverless environmentSummary
As mentioned on the ticket #161537, Analyst Experience Teams are going to need to start adding serverless tests.
We already have a lot of existing tests so taking into consideration the time restrictions and the head-ache of having to maintain duplicated code, we’d love to reuse the ones we can.
For Cypress specific, we explored two different ideas given by @semd and @patrykkopycinski with their support and advice (Thanks ❤️):
After exploring both options, finally it was decided to implement second one, because:
In this PR we are implementing the solution:
- We are going to maintain all the tests on the same folder to don’t disrupt developers flow, so specific Cypress serverless tests should be added to the regular folder.x-pack/test/security_solution_cypress
folderwaitForPageToBeLoaded
method. This is because cannot be reused for both ESS and Serverless and it has been demonstrated to not be useful since Cypress waits for an element to be present before performing an action.@ess
the tests that are executed on ESS environment.@serverless
the tests that are executed on serverless environment.@brokenInServerless
the tests that should be executed on serverless but currently are failing on that enviroment.IMPORTANT!!!!!
Once this PR is merged:
@serverless
@brokenInServerless
, I can give support and advice.yarn cypress:open
yarn cypress:open:serverless
to develop and debug tests on ESS environmentyarn cypress:open:serverless
to develop and debug tests on FTR serverless environment