-
Notifications
You must be signed in to change notification settings - Fork 81
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 #486 from roaksoax/revert_lsf_removal
Revert "Remove LSF from integration testing and core references (#481)"
- Loading branch information
Showing
6 changed files
with
144 additions
and
2 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 |
---|---|---|
@@ -1 +1 @@ | ||
6.7.1 | ||
6.7.2 |
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
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,108 @@ | ||
# encoding: utf-8 | ||
require "logstash/inputs/beats" | ||
require "logstash/json" | ||
require "fileutils" | ||
require_relative "../support/flores_extensions" | ||
require_relative "../support/file_helpers" | ||
require_relative "../support/integration_shared_context" | ||
require_relative "../support/client_process_helpers" | ||
require "spec_helper" | ||
|
||
LSF_BINARY = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "vendor", "logstash-forwarder", "logstash-forwarder")) | ||
|
||
describe "Logstash-Forwarder", :integration => true do | ||
include ClientProcessHelpers | ||
|
||
before :all do | ||
unless File.exist?(LSF_BINARY) | ||
raise "Cannot find `logstash-forwarder` binary in `vendor/logstash-forwarder` Did you run `bundle exec rake test:integration:setup` before running the integration suite?" | ||
end | ||
end | ||
|
||
include FileHelpers | ||
include_context "beats configuration" | ||
|
||
let(:client_wait_time) { 5 } | ||
|
||
# Filebeat related variables | ||
let(:cmd) { [lsf_exec, "-config", lsf_config_path] } | ||
|
||
let(:lsf_exec) { LSF_BINARY } | ||
let(:registry_file) { File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".logstash-forwarder")) } | ||
let_tmp_file(:lsf_config_path) { lsf_config } | ||
let(:log_file) { f = Stud::Temporary.file; f.close; f.path } | ||
let(:lsf_config) do | ||
<<-CONFIG | ||
{ | ||
"network": { | ||
"servers": [ "#{host}:#{port}" ], | ||
"ssl ca": "#{certificate_authorities}" | ||
}, | ||
"files": [ | ||
{ "paths": [ "#{log_file}" ] } | ||
] | ||
} | ||
CONFIG | ||
end | ||
# | ||
|
||
before :each do | ||
FileUtils.rm_rf(registry_file) # ensure clean state between runs | ||
start_client | ||
sleep(1) | ||
# let LSF start and than write the logs | ||
File.open(log_file, "a") do |f| | ||
f.write(events.join("\n") + "\n") | ||
end | ||
sleep(1) # give some time to the clients to pick up the changes | ||
end | ||
|
||
after :each do | ||
stop_client | ||
end | ||
|
||
xcontext "Plain TCP" do | ||
include ClientProcessHelpers | ||
|
||
let(:certificate_authorities) { "" } | ||
|
||
it "should not send any events" do | ||
expect(queue.size).to eq(0), @execution_output | ||
end | ||
end | ||
|
||
context "TLS" do | ||
context "Server Verification" do | ||
let(:input_config) do | ||
super().merge({ | ||
"ssl_enabled" => true, | ||
"ssl_certificate" => certificate_file, | ||
"ssl_key" => certificate_key_file, | ||
}) | ||
end | ||
|
||
let(:certificate_data) { Flores::PKI.generate } | ||
let_tmp_file(:certificate_file) { certificate_data.first } | ||
let_tmp_file(:certificate_key_file) { convert_to_pkcs8(certificate_data.last) } | ||
let(:certificate_authorities) { certificate_file } | ||
|
||
context "self signed certificate" do | ||
include_examples "send events" | ||
end | ||
|
||
context "with large batches" do | ||
let(:number_of_events) { 10_000 } | ||
include_examples "send events" | ||
end | ||
|
||
context "invalid CA on the client" do | ||
let(:invalid_data) { Flores::PKI.generate } | ||
let(:certificate_authorities) { f = Stud::Temporary.file; f.close; f.path } | ||
|
||
it "should not send any events" do | ||
expect(queue.size).to eq(0), @execution_output | ||
end | ||
end | ||
end | ||
end | ||
end |