|
2 | 2 |
|
3 | 3 | context "FipsValidation Integration Plugin" do
|
4 | 4 |
|
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 |
12 | 14 |
|
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") |
15 | 23 | expect(response).to be_successful
|
16 |
| - expect(response.stdout_lines.map(&:chomp)).to include("Installation successful") |
17 | 24 | 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) |
27 | 27 |
|
28 | 28 | aggregate_failures do
|
29 | 29 | 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 |
31 | 37 | end
|
32 | 38 | end
|
33 | 39 | end
|
|
0 commit comments