Skip to content

Commit

Permalink
add tests ensuring the raw optimized code flow is used
Browse files Browse the repository at this point in the history
  • Loading branch information
danmayer committed Feb 4, 2025
1 parent 32a13b4 commit 0f47fd5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/integration/test_operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@
end
end

it 'returns the value on a hit when using raw single server optimized get' do
memcached_persistent do |_, port|
dc = Dalli::Client.new("localhost:#{port}", namespace: 'some:namspace', raw: true)
dc.close
dc.flush

val1 = '1234567890' * 50
dc.set('a', val1)
val2 = dc.get('a')

assert_equal val1, val2
end
end

it 'return the value that include TERMINATOR on a hit' do
memcached_persistent do |dc|
dc.flush
Expand Down
22 changes: 22 additions & 0 deletions test/integration/test_pipelined_get.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,28 @@
end
end

it 'meta read_multi_req supports optimized raw get' do
memcached_persistent do |_, port|
dc = Dalli::Client.new("localhost:#{port}", namespace: 'some:namspace', raw: true)
dc.close
dc.flush

keys_to_query = %w[a b]

resp = dc.get_multi(keys_to_query)

assert_empty(resp)

dc.set('a', 'foo')
dc.set('b', 'bar')

resp = dc.get_multi(keys_to_query)
expected_resp = { 'a' => 'foo', 'b' => 'bar' }

assert_equal(expected_resp, resp)
end
end

it 'meta read_multi_req supports pipelined get doesnt default value on misses' do
memcached_persistent do |_, port|
dc = Dalli::Client.new("localhost:#{port}", namespace: 'some:namspace')
Expand Down

0 comments on commit 0f47fd5

Please sign in to comment.