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

DEBUG-2507 Test individual product loading #3738

Merged
merged 10 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/datadog/appsec/contrib/sinatra/patcher.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../../../tracing/contrib/rack/middlewares'
require_relative '../../../tracing/contrib'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Individual contribs require the REGISTRY constant defined by top-level contrib.


require_relative '../patcher'
require_relative '../../response'
Expand Down
1 change: 1 addition & 0 deletions lib/datadog/appsec/extensions.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require_relative 'configuration'
require_relative '../core/configuration'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a dependency on Core::Configuration in this file.


module Datadog
module AppSec
Expand Down
38 changes: 38 additions & 0 deletions spec/loading_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require 'shellwords'

REQUIRES = {
'datadog/appsec' => 'Datadog::AppSec',
'datadog/core' => 'Datadog::Core',
'datadog/kit' => 'Datadog::Kit',
'datadog/profiling' => 'Datadog::Profiling',
'datadog/tracing' => 'Datadog::Tracing',
}.freeze

RSpec.describe 'loading of products' do
REQUIRES.each do |req, const|
context req do
let(:code) do
<<-E
if defined?(Datadog)
unless Datadog.constants == [:VERSION]
exit 1
end
end

require "#{req}"

unless defined?(#{const})
exit 1
end

exit 0
E
end

it 'loads successfully by itself' do
rv = system("ruby -e #{Shellwords.shellescape(code)}")
Copy link
Member

Choose a reason for hiding this comment

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

Hey I didn't know shellescape existed! This is cool!

expect(rv).to be true
end
end
end
end
Loading