Skip to content

Commit

Permalink
Merge pull request #58 from saidie/fix/increase_wait_for_test
Browse files Browse the repository at this point in the history
Increase the time for waiting dummy fluentd processes to fix the tests
  • Loading branch information
repeatedly authored Jan 16, 2017
2 parents 22ba8e0 + 4267cc7 commit d43bb3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions spec/fluent_logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
expect {
logger.post('tag', data)
}.to raise_error(ArgumentError)

fluentd.wait_transfer # ensure the fluentd accepted the connection
}
end

Expand All @@ -128,6 +130,7 @@
host, port = fluent_logger.instance_eval { [@host, @port] }
expect(host).to eq 'localhost'
expect(port).to eq fluentd.port
fluentd.wait_transfer # ensure the fluentd accepted the connection
end

it "hash argument" do
Expand All @@ -139,6 +142,7 @@
host, port = fluent_logger.instance_eval { [@host, @port] }
expect(host).to eq 'localhost'
expect(port).to eq fluentd.port
fluentd.wait_transfer # ensure the fluentd accepted the connection
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions spec/level_fluent_logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,22 @@
})
expect(level_fluent_logger.level).to eq 0
expect(level_fluent_logger.progname).to be_nil
fluentd.wait_transfer # ensure the fluentd accepted the connection
}

it ('close') {
expect(level_logger).to be_connect
level_logger.close
expect(level_logger).not_to be_connect
fluentd.wait_transfer # ensure the fluentd accepted the connection
}

it ('reopen') {
expect(level_logger).to be_connect
level_logger.reopen
expect(level_logger).not_to be_connect
expect(level_logger.info('logger reopen test')).to be true
fluentd.wait_transfer # ensure the fluentd accepted the connection
}
end

Expand Down
2 changes: 1 addition & 1 deletion spec/support/dummy_fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize
output.emits.clear rescue nil
end

WAIT = ENV['WAIT'] ? ENV['WAIT'].to_f : 0.1
WAIT = ENV['WAIT'] ? ENV['WAIT'].to_f : 0.3

def wait_transfer
sleep WAIT
Expand Down

0 comments on commit d43bb3e

Please sign in to comment.