-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from DataDog/ivoanjo/prof-9963-dir-interruptio…
…n-testing-ruby-spec [PROF-9963] Add integration testing for Ruby dir interruption monkey patch
- Loading branch information
Showing
4 changed files
with
43 additions
and
0 deletions.
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 |