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

Failing test: Jest Tests.x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components - When on the host isolation exceptions entry form and creating a new exception should show validation error when a wrong ip value is entered. Case: "x.x.x.x" #136165

Closed
kibanamachine opened this issue Jul 12, 2022 · 6 comments · Fixed by #138566
Assignees
Labels
failed-test A test failure on a tracked branch, potentially flaky-test OLM Sprint Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.

Comments

@kibanamachine
Copy link
Contributor

kibanamachine commented Jul 12, 2022

A test failed on a tracked branch

Error: thrown: "Exceeded timeout of 5000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
    at /var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-each/build/bind.js:42:9
    at Array.forEach (<anonymous>)
    at eachBind (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-each/build/bind.js:41:20)
    at /var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form.test.tsx:108:5
    at _dispatchDescribe (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/index.js:67:26)
    at describe (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/index.js:30:5)
    at /var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form.test.tsx:95:3
    at _dispatchDescribe (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/index.js:67:26)
    at describe (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/index.js:30:5)
    at Object.<anonymous> (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form.test.tsx:32:1)
    at Runtime._execModule (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-runtime/build/index.js:1299:24)
    at Runtime._loadModule (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-runtime/build/index.js:898:12)
    at Runtime.requireModule (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-runtime/build/index.js:746:10)
    at jestAdapter (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:106:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runTestInternal (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-runner/build/runTest.js:380:16)
    at runTest (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-runner/build/runTest.js:472:34)
    at Object.worker (/var/lib/buildkite-agent/builds/kb-n2-4-spot-df1de9bfac87d895/elastic/kibana-on-merge/kibana/node_modules/jest-runner/build/testWorker.js:133:12)

First failure: CI Build - main

@kibanamachine kibanamachine added the failed-test A test failure on a tracked branch, potentially flaky-test label Jul 12, 2022
@botelastic botelastic bot added the needs-team Issues missing a team label label Jul 12, 2022
@kibanamachine kibanamachine added the Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. label Jul 12, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jul 12, 2022
@elasticmachine
Copy link
Contributor

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

@kevinlog kevinlog added the Team:Defend Workflows “EDR Workflows” sub-team of Security Solution label Jul 12, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt)

@kevinlog kevinlog self-assigned this Jul 12, 2022
@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

@mistic
Copy link
Member

mistic commented Jul 12, 2022

Skipped.

main: 6e01204

@paul-tavares
Copy link
Contributor

Investigation notes

So I was able to recreate this problem locally by running the test suite (top level describe() in this file) in a loop 10 times.

Observations:

  • I noticed that the tests failing are all part of a it.each() around validating the IP address field. Looking at the times those tests take to run locally (in a loop), they are significantly higher than other tests.
  • The IP validation logic uses RegExpr along with a 3rd party lib to validate IP entries
  • The UI validation error is only seen after the user "leaves" (tabs out) the field.

Attempts at a "fix" (did not work)

  • Commented out the code in the IP validation utility function
  • Broke out the tests in it.each() into individual tests (it())
  • Moved around some waitFor() calls

What worked (maybe)

The test was doing the following to simulate a user typing an IP address and then triggering the UI error:

userEvent.type(ipInput, value);
userEvent.tab();

When userEvent.tab() was replaced with a different approach - set focus to the description, which triggers the blur even to the IP input - the execution times for these set of tests were lowered significantly and they all started to pass.

In reading about userEvent.tab() (here), I see that it has a second argument (that we were not using) for cases where the focus is "trapped". This is actually the case with these tests - they are manipulating data on a form that is displayed in a Flyout that has the mask overlay for focus trap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failed-test A test failure on a tracked branch, potentially flaky-test OLM Sprint Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
Projects
None yet
5 participants