Skip to content

Commit d7ea817

Browse files
committed
test: Update ActiveSupportLogger tests
Test the outcome rather than the presence of variables
1 parent eda40db commit d7ea817

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

instrumentation/logger/test/opentelemetry/instrumentation/logger/patches/active_support_logger_test.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,34 @@
2323
after { instrumentation.instance_variable_set(:@installed, false) }
2424

2525
describe '#broadcast' do
26-
it 'emits the log to the Rails.logger' do
26+
it 'streams the log to the Rails.logger' do
2727
msg = "spruce #{rand(6)}"
2828
Rails.logger.debug(msg)
2929

3030
assert_match(/#{msg}/, LOG_STREAM.string)
3131
end
3232

33-
it 'emits the broadcasted log' do
33+
it 'streams the broadcasted log' do
3434
msg = "willow #{rand(6)}"
3535
Rails.logger.debug(msg)
3636

3737
assert_match(/#{msg}/, BROADCASTED_STREAM.string)
3838
end
3939

40-
it 'records the log record' do
40+
it 'emits the log record' do
4141
msg = "hemlock #{rand(6)}"
4242
Rails.logger.debug(msg)
4343
log_record = EXPORTER.emitted_log_records.first
4444

4545
assert_match(/#{msg}/, log_record.body)
4646
end
4747

48-
it 'does not add @skip_otel_emit to the initial logger' do
49-
refute Rails.logger.instance_variable_defined?(:@skip_otel_emit)
50-
end
48+
it 'emits the log record only once' do
49+
msg = "juniper #{rand(6)}"
50+
Rails.logger.debug(msg)
5151

52-
it 'adds @skip_otel_emit to broadcasted loggers' do
53-
assert broadcasted_logger.instance_variable_defined?(:@skip_otel_emit)
52+
assert_equal 1, EXPORTER.emitted_log_records.size
53+
assert_match(/#{msg}/, log_record.body)
5454
end
5555
end
5656
end

0 commit comments

Comments
 (0)