Skip to content

Commit b259d21

Browse files
committed
SymDB components spec: cover symbol_database wiring and shutdown
#5717 wired SymbolDatabase::Component into Core::Configuration::Components (build at @symbol_database, shutdown! during teardown) but did not extend components_spec.rb to cover the new wiring. Add an @symbol_database describe block with two contexts: - symbol_database disabled → components.symbol_database is nil - symbol_database + remote config enabled → components.symbol_database is a Datadog::SymbolDatabase::Component (skipped on JRuby and Ruby < 2.6 per the feature's support matrix) Also extend the #shutdown! test to assert that components.symbol_database receives shutdown! when present, matching the pattern already used for dynamic_instrumentation, appsec, etc.
1 parent 5f2dad9 commit b259d21

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

spec/datadog/core/configuration/components_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,33 @@
173173
end
174174
end
175175
end
176+
177+
describe '@symbol_database' do
178+
context 'when symbol_database is disabled' do
179+
before { settings.symbol_database.enabled = false }
180+
181+
it 'does not build a symbol_database component' do
182+
expect(components.symbol_database).to be nil
183+
end
184+
end
185+
186+
context 'when symbol_database is enabled with remote config' do
187+
before(:all) do
188+
skip 'Symbol database requires MRI Ruby 2.6+' if PlatformHelpers.jruby? || RUBY_VERSION < '2.6'
189+
end
190+
191+
before do
192+
settings.symbol_database.enabled = true
193+
settings.remote.enabled = true
194+
end
195+
196+
after { components.symbol_database&.shutdown! }
197+
198+
it 'builds a SymbolDatabase::Component' do
199+
expect(components.symbol_database).to be_a(Datadog::SymbolDatabase::Component)
200+
end
201+
end
202+
end
176203
end
177204

178205
describe '::build_health_metrics' do
@@ -631,6 +658,7 @@ def self.on_load(*)
631658
expect(components.remote).to receive(:shutdown!) unless components.remote.nil?
632659
expect(components.profiler).to receive(:shutdown!) unless components.profiler.nil?
633660
expect(components.dynamic_instrumentation).to receive(:shutdown!) unless components.dynamic_instrumentation.nil?
661+
expect(components.symbol_database).to receive(:shutdown!) unless components.symbol_database.nil?
634662
expect(components.appsec).to receive(:shutdown!) unless components.appsec.nil?
635663
expect(components.runtime_metrics).to receive(:stop)
636664
.with(true, close_metrics: false)

0 commit comments

Comments
 (0)