Skip to content

Commit a8011ba

Browse files
committed
skip non-fips spec on fips-configured artifact, add spec details
1 parent b1089bf commit a8011ba

File tree

2 files changed

+32
-20
lines changed

2 files changed

+32
-20
lines changed

x-pack/qa/integration/fips-validation/logstash-integration-fips-validation_spec.rb

+26-20
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,38 @@
22

33
context "FipsValidation Integration Plugin" do
44

5-
before(:all) do
6-
logstash_home = Pathname.new(get_logstash_path).cleanpath
7-
build_dir = (logstash_home / "build" / "gems")
8-
gems = build_dir.glob("logstash-integration-fips_validation-*.gem")
9-
fail("No FipsValidation Gem in #{build_dir}") if gems.none?
10-
fail("Multiple FipsValidation Gems in #{build_dir}") if gems.size > 1
11-
fips_validation_plugin = gems.first
5+
context "when running on stock Logstash", :skip_fips do
6+
# on non-FIPS Logstash, we need to install the plugin ourselves
7+
before(:all) do
8+
logstash_home = Pathname.new(get_logstash_path).cleanpath
9+
build_dir = (logstash_home / "build" / "gems")
10+
gems = build_dir.glob("logstash-integration-fips_validation-*.gem")
11+
fail("No FipsValidation Gem in #{build_dir}") if gems.none?
12+
fail("Multiple FipsValidation Gems in #{build_dir}") if gems.size > 1
13+
fips_validation_plugin = gems.first
1214

13-
response = logstash_plugin("install", fips_validation_plugin.to_s)
14-
aggregate_failures('setup') do
15+
response = logstash_plugin("install", fips_validation_plugin.to_s)
16+
aggregate_failures('setup') do
17+
expect(response).to be_successful
18+
expect(response.stdout_lines.map(&:chomp)).to include("Installation successful")
19+
end
20+
end
21+
after(:all) do
22+
response = logstash_plugin("remove", "logstash-integration-fips_validation")
1523
expect(response).to be_successful
16-
expect(response.stdout_lines.map(&:chomp)).to include("Installation successful")
1724
end
18-
end
19-
after(:all) do
20-
response = logstash_plugin("remove", "logstash-integration-fips_validation")
21-
expect(response).to be_successful
22-
end
23-
24-
context "when running on stock Logstash" do
25-
it "prevents Logstash from running" do
26-
process = logstash_with_empty_default("bin/logstash --log.level=debug -e 'generator { count => 1 }'", timeout: 60)
25+
it "prevents Logstash from running and logs helpful guidance" do
26+
process = logstash_with_empty_default("bin/logstash --log.level=debug -e 'input { generator { count => 1 } }'", timeout: 60)
2727

2828
aggregate_failures do
2929
expect(process).to_not be_successful
30-
expect(process.stdout_lines.join).to include("Logstash is not configured in a FIPS-compliant manner")
30+
process.stdout_lines.join.tap do |stdout|
31+
expect(stdout).to_not include("Pipeline started")
32+
expect(stdout).to include("Java security providers are misconfigured")
33+
expect(stdout).to include("Java SecureRandom provider is misconfigured")
34+
expect(stdout).to include("Bouncycastle Crypto unavailable")
35+
expect(stdout).to include("Logstash is not configured in a FIPS-compliant manner")
36+
end
3137
end
3238
end
3339
end

x-pack/qa/integration/spec_helper.rb

+6
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@
99
require_relative "support/elasticsearch/api/actions/update_password"
1010
require "json"
1111
require "json-schema"
12+
13+
RSpec.configure do |c|
14+
if java.lang.System.getProperty("org.bouncycastle.fips.approved_only") == "true"
15+
c.filter_run_excluding skip_fips: true
16+
end
17+
end

0 commit comments

Comments
 (0)