diff --git a/test/command/test_ca_generate.rb b/test/command/test_ca_generate.rb index ee807294de..6ef635088e 100644 --- a/test/command/test_ca_generate.rb +++ b/test/command/test_ca_generate.rb @@ -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