Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport(v1.16): tests: use never instead of dont_allow (#4671) #4723

Open
wants to merge 1 commit into
base: v1.16
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/plugin/out_forward/test_socket_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SocketCacheTest < Test::Unit::TestCase
assert_equal(socket, c.checkout_or('key') { socket })
c.checkin(socket)

sock = dont_allow(mock!).open
sock = mock!.open.never.subject
assert_equal(socket, c.checkout_or('key') { sock.open })
end

Expand Down Expand Up @@ -130,7 +130,7 @@ def teardown

c = Fluent::Plugin::ForwardOutput::SocketCache.new(10, $log)
sock = mock!.close { 'closed' }.subject
sock2 = dont_allow(mock!).close
sock2 = mock!.close.never.subject
stub(sock).inspect
stub(sock2).inspect

Expand All @@ -154,7 +154,7 @@ def teardown
Timecop.freeze(Time.parse('2016-04-13 14:00:00 +0900'))

c = Fluent::Plugin::ForwardOutput::SocketCache.new(10, $log)
sock = dont_allow(mock!).close
sock = mock!.close.never.subject
stub(sock).inspect
c.checkout_or('key') { sock }

Expand Down
4 changes: 2 additions & 2 deletions test/test_event_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def event_router
test "don't call default collector when tag matched" do
event_router.add_rule('test', output)
assert_rr do
dont_allow(default_collector).emit_events('test', is_a(OneEventStream))
mock(default_collector).emit_events('test', is_a(OneEventStream)).never
event_router.emit('test', Engine.now, 'k' => 'v')
end
# check emit handler doesn't catch rr error
Expand All @@ -201,7 +201,7 @@ def filter_stream(_tag, es); end
event_router.add_rule('test', filter)

assert_rr do
dont_allow(filter).filter_stream('test', is_a(OneEventStream)) { events }
mock(filter).filter_stream('test', is_a(OneEventStream)).never
event_router.emit('foo', Engine.now, 'k' => 'v')
end
end
Expand Down
Loading