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

test: skip if error is occured #2881

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/fluent/plugin/sd_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def refresh_file(queue)
fetch_server_info
rescue => e
@log.error("sd_file: #{e}")
return
end

if s.nil?
Expand Down
17 changes: 17 additions & 0 deletions test/plugin/test_sd_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ def create_tmp_config(path, body)
assert_empty queue
end

test 'Skip if error is occured' do
@sd_file.extend(TestStatEventHelperWrapper)

create_tmp_config('config.json', JSON.generate([{ port: 1233, host: '127.0.0.1' }]))
@sd_file.configure(config_element('service_discovery', '', { 'path' => File.join(@dir, 'config.yml') }))
queue = []

FileUtils.rm_r(File.join(@dir, 'tmp', 'config.json'))
mock.proxy(@sd_file).refresh_file(queue).twice

@sd_file.start(queue)
assert_empty queue

@sd_file.resume
assert_empty queue
end

test 'if service is updated, service_in and service_out event happen' do
@sd_file.extend(TestStatEventHelperWrapper)

Expand Down