mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
parent
d3357232b8
commit
86502c0bb7
1 changed files with 13 additions and 16 deletions
|
@ -8,6 +8,9 @@ require "yaml"
|
|||
describe "Test Logstash instance" do
|
||||
before(:all) {
|
||||
@fixture = Fixture.new(__FILE__)
|
||||
# used in multiple LS tests
|
||||
@ls1 = @fixture.get_service("logstash")
|
||||
@ls2 = LogstashService.new(@fixture.settings)
|
||||
}
|
||||
|
||||
after(:all) {
|
||||
|
@ -15,8 +18,8 @@ describe "Test Logstash instance" do
|
|||
}
|
||||
|
||||
after(:each) {
|
||||
ls = @fixture.get_service("logstash")
|
||||
ls.teardown
|
||||
@ls1.teardown
|
||||
@ls2.teardown
|
||||
}
|
||||
|
||||
let(:num_retries) { 10 }
|
||||
|
@ -24,37 +27,31 @@ describe "Test Logstash instance" do
|
|||
let(:config2) { config_to_temp_file(@fixture.config("root", { :port => random_port })) }
|
||||
|
||||
it "can start the embedded http server on default port 9600" do
|
||||
logstash_service = @fixture.get_service("logstash")
|
||||
logstash_service.start_with_stdin
|
||||
@ls1.start_with_stdin
|
||||
try(num_retries) do
|
||||
expect(is_port_open?(9600)).to be true
|
||||
end
|
||||
logstash_service.teardown
|
||||
end
|
||||
|
||||
it "multiple of them can be started on the same box with automatically trying different ports for HTTP server" do
|
||||
ls1 = @fixture.get_service("logstash")
|
||||
ls1.spawn_logstash("-f", config1)
|
||||
@ls1.spawn_logstash("-f", config1)
|
||||
try(num_retries) do
|
||||
expect(is_port_open?(9600)).to be true
|
||||
end
|
||||
|
||||
puts "will try to start the second LS instance on 9601"
|
||||
|
||||
# bring up new LS instance
|
||||
ls2 = LogstashService.new(@fixture.settings)
|
||||
ls2.spawn_logstash("-f", config2)
|
||||
try do
|
||||
@ls2.spawn_logstash("-f", config2)
|
||||
try(num_retries) do
|
||||
expect(is_port_open?(9601)).to be true
|
||||
end
|
||||
|
||||
expect(ls1.process_id).not_to eq(ls2.process_id)
|
||||
ls1.teardown
|
||||
ls2.teardown
|
||||
expect(@ls1.process_id).not_to eq(@ls2.process_id)
|
||||
end
|
||||
|
||||
it "gets the right version when asked" do
|
||||
ls = @fixture.get_service("logstash")
|
||||
expected = YAML.load_file(LogstashService::LS_VERSION_FILE)
|
||||
expect(ls.get_version.strip).to eq("logstash #{expected['logstash']}")
|
||||
ls.teardown
|
||||
expect(@ls1.get_version.strip).to eq("logstash #{expected['logstash']}")
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue