mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
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
40 lines
1 KiB
Ruby
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
|