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

Disable package capture when testing #1165

Merged
merged 4 commits into from
Jun 13, 2024
Merged

Disable package capture when testing #1165

merged 4 commits into from
Jun 13, 2024

Conversation

hmstepanek
Copy link
Contributor

@hmstepanek hmstepanek commented Jun 12, 2024

Overview

Package capturing is slow and we don't need to do it for every test. Disable package capturing unless we are explicitly testing it.

Previously, when it took too long to capture the package info, it caused application connect timeouts that raised an AssertionError of application.active.

@hmstepanek hmstepanek requested a review from a team June 12, 2024 19:58
Copy link

github-actions bot commented Jun 12, 2024

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 79 0 0 1.39s
✅ PYTHON flake8 79 0 0.86s
✅ PYTHON isort 79 0 0 0.29s
❌ PYTHON pylint 79 27 10.21s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@codecov-commenter
Copy link

codecov-commenter commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@44ccef0). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1165   +/-   ##
=======================================
  Coverage        ?   81.76%           
=======================================
  Files           ?      195           
  Lines           ?    21643           
  Branches        ?     3779           
=======================================
  Hits            ?    17696           
  Misses          ?     2850           
  Partials        ?     1097           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hmstepanek hmstepanek force-pushed the fix-package-capture branch from a636f24 to 6f4892c Compare June 12, 2024 22:26
@mergify mergify bot removed the tests-failing label Jun 12, 2024
Copy link
Contributor

@lrafeei lrafeei left a comment

Choose a reason for hiding this comment

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

I see the flag being set in the tests that do not need the package capture, but I am not seeing where the flag's status does anything with the function itself (in the config.py to set the setting/flag or the package capture function itself)

Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, what is this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops...it's a cprofile output..how did that get in there!? Removing...

@hmstepanek
Copy link
Contributor Author

I see the flag being set in the tests that do not need the package capture, but I am not seeing where the flag's status does anything with the function itself (in the config.py to set the setting/flag or the package capture function itself)

The package capture setting is in the config file here: https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/config.py#L567.
It is used here inside the environment_settings function to skip capturing the plugins if it is disabled: https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/core/environment.py#L207.

@lrafeei
Copy link
Contributor

lrafeei commented Jun 13, 2024

I see the flag being set in the tests that do not need the package capture, but I am not seeing where the flag's status does anything with the function itself (in the config.py to set the setting/flag or the package capture function itself)

The package capture setting is in the config file here: https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/config.py#L567. It is used here inside the environment_settings function to skip capturing the plugins if it is disabled: https://github.com/newrelic/newrelic-python-agent/blob/main/newrelic/core/environment.py#L207.

Oh, OK, that's what I was missing--I did not realize this was a flag we already had. Looks good to me!

@mergify mergify bot removed the tests-failing label Jun 13, 2024
@hmstepanek hmstepanek merged commit 4ddc5b1 into main Jun 13, 2024
51 of 52 checks passed
@hmstepanek hmstepanek deleted the fix-package-capture branch June 13, 2024 18:43
@umaannamalai umaannamalai added this to the v9.11.0 milestone Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants