-
Notifications
You must be signed in to change notification settings - Fork 0
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
[PROF-9963] Add integration testing for Ruby dir interruption monkey patch #41
Merged
ivoanjo
merged 3 commits into
main
from
ivoanjo/prof-9963-dir-interruption-testing-ruby-spec
Jul 2, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM ruby:3.3 | ||
|
||
ENV DD_PROFILING_ENABLED true | ||
ENV DD_PROFILING_DIR_INTERRUPTION_WORKAROUND_ENABLED true | ||
|
||
COPY ./scenarios/ruby_dir_interruption_patch/*.rb /app/ | ||
RUN chmod 755 /app/* | ||
|
||
WORKDIR /app | ||
RUN bundle install | ||
|
||
RUN wget https://github.com/ruby/spec/archive/refs/heads/master.zip -O spec-master.zip | ||
RUN wget https://github.com/ruby/mspec/archive/refs/heads/master.zip -O mspec-master.zip | ||
RUN unzip spec-master.zip | ||
RUN unzip mspec-master.zip | ||
|
||
# Since we aggressively drop permissions when running, we need to manually create a folder for rubyspec to use | ||
RUN mkdir /app/rubyspec_temp | ||
RUN chmod 777 /app/rubyspec_temp | ||
|
||
# Needed by one of the ruby specs (which is testing access to home) | ||
# @ivoanjo: Locally I get uid 1000, and in CI I'm seeing 1001. I am not sure why they differ, or if any other uids | ||
# can show up. But, if we're missing this for an user, it'll cause the tests to fail so we definitely won't miss it. | ||
RUN useradd -u 1000 -ms /bin/bash someuser | ||
RUN useradd -u 1001 -ms /bin/bash someuser2 | ||
|
||
CMD bundle exec ddprofrb exec ruby mspec-master/bin/mspec-run --config mspec_config.rb spec-master/core/dir/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"test_name": "ruby_dir_interruption_patch", | ||
"stacks": [], | ||
"note": "This test has no stacks, as it's not expected to emit profiles -- we're only testing that the mspec run is successful even when the profiler monkey patches are available." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'datadog', git: 'https://github.com/datadog/dd-trace-rb.git', branch: 'master' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Datadog::Profiling.wait_until_running | ||
|
||
if Dir.ancestors.first == Datadog::Profiling::Ext::DirInstanceMonkeyPatches && | ||
Dir.singleton_class.ancestors.first == Datadog::Profiling::Ext::DirClassMonkeyPatches | ||
puts "Dir interruption patch is present!" | ||
else | ||
raise 'Dir interruption patch is not present!' | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we catch the failure correctly if this does not run ? I think absence of pprof is enough to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes -- you can actually see it failing in https://github.com/DataDog/prof-correctness/actions/runs/9758283260/job/26932502637 and then I added a ugly workaround in af8650b .