Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bouwkast committed Nov 27, 2024
1 parent c9f7952 commit d90c4f7
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions spec/datadog/tracing/contrib/rails/cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@
.to eq('cache')
end

context 'when cache_key_enabled is false' do
context 'when cache_key.enabled is false' do
before do
Datadog.configuration.tracing[:active_support][:cache_key_enabled] = false
Datadog.configuration.tracing[:active_support][:cache_key].enabled = false
end

it do
expect(read).to eq(50)

expect(spans).to have(2).items
get = spans
get, = spans
expect(get.name).to eq('rails.cache')
expect(get.get_tag('rails.cache.key')).to be_nil
end
Expand Down Expand Up @@ -165,9 +165,9 @@
end
end

context 'when cache_key_enabled is false' do
context 'when cache_key.enabled is false' do
before do
Datadog.configuration.tracing[:active_support][:cache_key_enabled] = false
Datadog.configuration.tracing[:active_support][:cache_key].enabled = false
end

it do
Expand Down Expand Up @@ -221,15 +221,15 @@
end
end

context 'when cache_key_enabled is false' do
context 'when cache_key.enabled is false' do
before do
Datadog.configuration.tracing[:active_support][:cache_key_enabled] = false
Datadog.configuration.tracing[:active_support][:cache_key].enabled = false
end

let(:key) { ['custom-key', %w[x y], user] }
let(:user) { double('User', cache_key: 'User:3') }

it 'does not expand key using ActiveSupport when cache_key_enabled false' do
it 'does not expand key using ActiveSupport when cache_key.enabled false' do
write
expect(span.get_tag('rails.cache.key')).to be_nil
end
Expand Down Expand Up @@ -284,9 +284,9 @@
end
end

context 'when cache_key_enabled is false' do
context 'when cache_key.enabled is false' do
before do
Datadog.configuration.tracing[:active_support][:cache_key_enabled] = false
Datadog.configuration.tracing[:active_support][:cache_key].enabled = false
end

it do
Expand Down Expand Up @@ -343,9 +343,9 @@
.to eq('cache')
end

context 'when cache_key_enabled is false' do
context 'when cache_key.enabled is false' do
before do
Datadog.configuration.tracing[:active_support][:cache_key_enabled] = false
Datadog.configuration.tracing[:active_support][:cache_key].enabled = false
end

it do
Expand Down Expand Up @@ -392,9 +392,9 @@
end
end

context 'when cache_key_enabled is false' do
context 'when cache_key.enabled is false' do
before do
Datadog.configuration.tracing[:active_support][:cache_key_enabled] = false
Datadog.configuration.tracing[:active_support][:cache_key].enabled = false
end

subject(:fetch) { cache.fetch('exception') { raise 'oops' } }
Expand Down Expand Up @@ -452,9 +452,9 @@
end
end

context 'with exception and when cache_key_enabled is false' do
context 'with exception and when cache_key.enabled is false' do
before do
Datadog.configuration.tracing[:active_support][:cache_key_enabled] = false
Datadog.configuration.tracing[:active_support][:cache_key].enabled = false
end
subject(:fetch_multi) { cache.fetch_multi('exception', 'another', 'one') { raise 'oops' } }

Expand Down Expand Up @@ -514,9 +514,9 @@
end
end

context 'with very large cache key and when cache_key_enabled is false' do
context 'with very large cache key and when cache_key.enabled is false' do
before do
Datadog.configuration.tracing[:active_support][:cache_key_enabled] = false
Datadog.configuration.tracing[:active_support][:cache_key].enabled = false
end
it 'truncates key too large' do
max_key_size = Datadog::Tracing::Contrib::ActiveSupport::Ext::QUANTIZE_CACHE_MAX_KEY_SIZE
Expand Down

0 comments on commit d90c4f7

Please sign in to comment.