logstash/spec/runner_spec.rb
Joao Duarte b0091b242c Remove the ability to run multiple commands
Addresses #1747.
This removes the argument list iteration and spawning of multiple
tasks.
It's still possible to specify aditional arguments but now they're
ignored.

PR: #1752
2014-09-27 04:57:21 +00:00

40 lines
1 KiB
Ruby

require "logstash/runner"
require "logstash/agent"
require "logstash/kibana"
require "stud/task"
class NullRunner
def run(args); end
end
describe LogStash::Runner do
context "argument parsing" do
it "should run agent" do
expect(Stud::Task).to receive(:new).once.and_return(nil)
args = ["agent", "-e", ""]
expect(subject.run(args)).to eq(nil)
end
it "should run agent help" do
expect(subject).to receive(:show_help).once.and_return(nil)
args = ["agent", "-h"]
expect(subject.run(args).wait).to eq(0)
end
it "should run agent help and not run following commands" do
expect(subject).to receive(:show_help).once.and_return(nil)
args = ["agent", "-h", "web"]
expect(subject.run(args).wait).to eq(0)
end
it "should not run agent and web" do
expect(Stud::Task).to receive(:new).once
args = ["agent", "-e", "", "web"]
args = subject.run(args)
expect(args).to eq(nil)
expect(LogStash::Kibana::Runner).to_not receive(:new)
end
end
end