forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request elastic#1212 from colinsurprenant/agent_stall
fix agent stall when also using web argument
- Loading branch information
Showing
2 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |