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

[Security Solution] Cypress test runner doesn't start locally on Intel-based Macs #164435

Closed
Tracked by #153633
banderror opened this issue Aug 22, 2023 · 5 comments
Closed
Tracked by #153633
Labels
bug Fixes for quality problems that affect the customer experience Team:Detection Engine Security Solution Detection Engine Area Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team technical debt Improvement of the software architecture and operational architecture test

Comments

@banderror
Copy link
Contributor

banderror commented Aug 22, 2023

Epic: #153633
Related to: #162698 (review)

Summary

If you are on a Macbook with an Intel processor, and you cd x-pack/test/security_solution_cypress and yarn cypress:open:ess, you will see an error and Cypress test runner won'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.
  • Apparently, it still starts local ES and Kibana
  • You can still run Serverless Cypress tests without issues: yarn cypress:open:serverless
  • It works on Apple Silicon

We need to fix the root cause so people don't have to use the workaround (below).

Workaround

@nkhristinin suggested a workaround: run Cypress tests against your local ES and Kibana. You will need to run ES and Kibana separately, and then run only the Cypress test runner pointing to them:

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 didn't work for @nkhristinin until he commented this in kibana.dev.yaml:

# server.name: kibana
# server.host: "0.0.0.0"

Cause

@rylnd and @nkhristinin got some more data and they have reproducibly (at least on two machines) isolated this issue to a particular commit: 757c881b9a8. Running FTRs locally before this commit works as expected; afterward they fail.

They isolated it to some new transforms being installed/started during o11y's plugin setup:

diff --git a/x-pack/plugins/observability/server/plugin.ts b/x-pack/plugins/observability/server/plugin.ts
index 0b0b7207d69..8c5f06dcbc9 100644
--- a/x-pack/plugins/observability/server/plugin.ts
+++ b/x-pack/plugins/observability/server/plugin.ts
@@ -277,7 +277,7 @@ export class ObservabilityPlugin implements Plugin<ObservabilityPluginSetup> {
         sloSummaryInstaller,
         this.logger
       );
-      sloInstaller.install();
+      // sloInstaller.install();
     });
 
     /**

What appears to be happening is that the transform is being started, does not respond within 30s, and the uncaught error response then crashes kibana.

This doesn't affect CI because of this code:

    if (this.isInstalling || process.env.CI) {
      return;
    }
@banderror banderror added bug Fixes for quality problems that affect the customer experience test technical debt Improvement of the software architecture and operational architecture Team:Detections and Resp Security Detection Response Team Team:Threat Hunting Security Solution Threat Hunting Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Team:Detection Engine Security Solution Detection Engine Area 8.11 candidate labels Aug 22, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

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

@nkhristinin
Copy link
Contributor

For me locally also help to disable observability for our cypress tests

Add '--xpack.observability.enabled=false', to this file x-pack/test/security_solution_cypress/config.ts

@MadameSheema
Copy link
Member

For me locally also help to disable observability for our cypress tests
Add '--xpack.observability.enabled=false', to this file x-pack/test/security_solution_cypress/config.ts

This is great @nkhristinin!! :D

Having observability disabled can impact the behaviour of our application?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Detection Engine Security Solution Detection Engine Area Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team technical debt Improvement of the software architecture and operational architecture test
Projects
Development

No branches or pull requests

4 participants