Skip to content

Commit

Permalink
Add failure test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmo0920 committed Jan 16, 2018
1 parent 6cfbc2c commit b37e953
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/command/test_ca_generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,24 @@ def test_ca_generate
TEXT
assert_equal(expected, dumped_output)
end

test "invalid options" do
Dir.mktmpdir do |dir|
assert_raise(OptionParser::InvalidOption) do
Fluent::CaGenerate.new([dir, "fluentd",
"--invalid"]).call
end
assert_false(File.exist?(File.join(dir, "ca_key.pem")))
assert_false(File.exist?(File.join(dir, "ca_cert.pem")))
end
end

test "empty options" do
assert_raise(SystemExit) do
out = capture_stdout do
Fluent::CaGenerate.new([]).call
end
end
end
end
end

0 comments on commit b37e953

Please sign in to comment.