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

Reporting tests with open handles preventing Jest from completing #115881

Closed
tylersmalley opened this issue Oct 20, 2021 · 6 comments · Fixed by #117984 or #121903
Closed

Reporting tests with open handles preventing Jest from completing #115881

tylersmalley opened this issue Oct 20, 2021 · 6 comments · Fixed by #117984 or #121903
Assignees
Labels
bug Fixes for quality problems that affect the customer experience (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Feature:Reporting:Framework Reporting issues pertaining to the overall framework impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:medium Medium Level of Effort needs-team Issues missing a team label

Comments

@tylersmalley
Copy link
Contributor

tylersmalley commented Oct 20, 2021

Github issue description exceeds 32767 characters. This is too long for Jira. See the GH issue.

@tylersmalley tylersmalley added bug Fixes for quality problems that affect the customer experience Team:Reporting Services labels Oct 20, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-reporting-services (Team:Reporting Services)

@tylersmalley
Copy link
Contributor Author

tylersmalley commented Oct 20, 2021

Also while you're looking at this, I am wondering if we could suppress the debug logs triggered by these tests.

Example:

 PASS  x-pack/plugins/reporting/server/lib/screenshots/get_number_of_items.test.ts
  ● Console

    console.log
      debug Task to monitor for pending reports to run every 3s.

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

    console.log
      warn Enabling the Chromium sandbox provides an additional layer of protection.

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

    console.log
      debug waiting for elements or items count attribute; or not found to interrupt

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

    console.log
      debug Task to monitor for pending reports to run every 3s.

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

    console.log
      warn Enabling the Chromium sandbox provides an additional layer of protection.

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

    console.log
      debug waiting for elements or items count attribute; or not found to interrupt

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

    console.log
      debug Task to monitor for pending reports to run every 3s.

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

    console.log
      warn Enabling the Chromium sandbox provides an additional layer of protection.

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

    console.log
      debug waiting for elements or items count attribute; or not found to interrupt

      at LevelLogger.<anonymous> (x-pack/plugins/reporting/server/test_helpers/create_mock_levellogger.ts:15:72)

@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Oct 22, 2021
@jloleysens
Copy link
Contributor

jloleysens commented Nov 5, 2021

I looked into this a little bit and it looks like the issue for the open handles is the combination of jest and mock-fs (see tschaub/mock-fs#341).

This is not limited to Reporting tests as I was able to reproduce this in other tests using mock-fs. We could try and fix this upstream, create a patch for the module, or create a custom FS mock using jest. I think we can try fix this in that order :D

@vadimkibana
Copy link
Contributor

vadimkibana commented Nov 8, 2021

I see @jloleysens you already have a fix PR for upstream dependency, which is great. Just wanted to check with you one more idea: what do you think about not mocking the file system? Instead using the real file system, then cleaning up once tests finish.

@jloleysens
Copy link
Contributor

@vadimkibana , yeah I think that would be a feasible option too. Might just make the tests need to know even more about implementation details though.

@tsullivan
Copy link
Member

tsullivan commented Dec 2, 2021

Oops, there is still one skipped test that leaves an open handle:

node scripts/jest --detectOpenHandles --config x-pack/plugins/reporting/jest.config.js x-pack/plugins/reporting/server/routes/deprecations.test.ts

The tests are passing but the command stays open without exiting. I don't see nay warnings or clues about how to unskip this test.

@tsullivan tsullivan reopened this Dec 2, 2021
@tsullivan tsullivan self-assigned this Dec 2, 2021
@exalate-issue-sync exalate-issue-sync bot added loe:medium Medium Level of Effort and removed loe:small Small Level of Effort labels Dec 21, 2021
@sophiec20 sophiec20 added (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Feature:Reporting:Framework Reporting issues pertaining to the overall framework and removed (Deprecated) Team:Reporting Services labels Aug 21, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Aug 21, 2024
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 (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Feature:Reporting:Framework Reporting issues pertaining to the overall framework impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:medium Medium Level of Effort needs-team Issues missing a team label
Projects
None yet
6 participants