Skip to content

Commit

Permalink
Fix Rubocop test lints - 2022-10 (#934)
Browse files Browse the repository at this point in the history
Shifts integration test into appropriate file, ensures we have a memcached instance running, and uses a protocol from that client for the tests.
  • Loading branch information
petergoldstein committed Oct 27, 2022
1 parent 48d594d commit 72c4171
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
24 changes: 24 additions & 0 deletions test/integration/test_pipelined_get.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@
assert_empty expected_resp
end
end

describe 'pipeline_next_responses' do
it 'raises NetworkError when called before pipeline_response_setup' do
memcached_persistent(p) do |dc|
server = dc.instance_variable_get(:@ring).servers.first
server.request(:pipelined_get, %w[a b])
assert_raises Dalli::NetworkError do
server.pipeline_next_responses
end
end
end

it 'raises NetworkError when called after pipeline_abort' do
memcached_persistent(p) do |dc|
server = dc.instance_variable_get(:@ring).servers.first
server.request(:pipelined_get, %w[a b])
server.pipeline_response_setup
server.pipeline_abort
assert_raises Dalli::NetworkError do
server.pipeline_next_responses
end
end
end
end
end
end
end
20 changes: 0 additions & 20 deletions test/protocol/test_binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,4 @@
expect(-> { Dalli::Protocol::Binary.new('my.fqdn.com:11212:abc') }).must_raise Dalli::DalliError
end
end

describe 'pipeline_next_responses' do
subject { Dalli::Protocol::Binary.new('127.0.0.1') }

it 'raises NetworkError when called before pipeline_response_setup' do
assert_raises Dalli::NetworkError do
subject.request(:pipelined_get, %w[a b])
subject.pipeline_next_responses
end
end

it 'raises NetworkError when called after pipeline_abort' do
assert_raises Dalli::NetworkError do
subject.request(:pipelined_get, %w[a b])
subject.pipeline_response_setup
subject.pipeline_abort
subject.pipeline_next_responses
end
end
end
end

0 comments on commit 72c4171

Please sign in to comment.