forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner_spec.rb
42 lines (35 loc) · 1.11 KB
/
runner_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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)).to eq([])
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)).to eq([])
end
it "should run agent and web" do
expect(Stud::Task).to receive(:new).once
args = ["agent", "-e", "", "web"]
args = subject.run(args)
expect(args).to eq(["web"])
expect(LogStash::Kibana::Runner).to receive(:new).once.and_return(NullRunner.new)
args = subject.run(args)
expect(args).to eq(nil)
end
end
end