Skip to content

Ensure Rails testing is considered a development environment#3062

Merged
marcotc merged 8 commits into
masterfrom
rails-test-detect
Sep 19, 2023
Merged

Ensure Rails testing is considered a development environment#3062
marcotc merged 8 commits into
masterfrom
rails-test-detect

Conversation

@marcotc

@marcotc marcotc commented Aug 18, 2023

Copy link
Copy Markdown
Member

What does this PR do?

This PR detects if a Rails application is running in development or test mode, and uses this information to inform ddtrace internally in order improve logging and background worker management.

Motivation

Currently, we consider local development Rails console as a production environment, which is incorrect.

Additional Notes

This checking ensures staging, which is a common non-stardard Rails environment is considered "not development" by ddtrace.

How to test the change?

There are unit test covering this change.

@marcotc
marcotc force-pushed the rails-test-detect branch from 3997a09 to f89f2f3 Compare August 28, 2023 22:22
@marcotc marcotc self-assigned this Aug 29, 2023

@anmarchenko anmarchenko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we need to go forward with that because there are still issues with telemetry and RC being reported.

Do you think we would need to add a check for Cucumber in test? method?

Comment thread sig/datadog/core/environment/execution.rbs Outdated
@marcotc
marcotc marked this pull request as ready for review September 19, 2023 20:10
@marcotc
marcotc requested a review from a team September 19, 2023 20:10
@marcotc

marcotc commented Sep 19, 2023

Copy link
Copy Markdown
Member Author

Do you think we would need to add a check for Cucumber in test? method?

That's a good idea, I'll open a separate PR.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #3062 (f648160) into master (74cb196) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3062   +/-   ##
=======================================
  Coverage   98.16%   98.16%           
=======================================
  Files        1283     1283           
  Lines       73898    73918   +20     
  Branches     3421     3421           
=======================================
+ Hits        72542    72565   +23     
+ Misses       1356     1353    -3     
Files Changed Coverage Δ
lib/datadog/core/environment/execution.rb 100.00% <100.00%> (ø)
spec/datadog/core/environment/execution_spec.rb 96.11% <100.00%> (+0.66%) ⬆️

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants