Skip to content

Commit 41a470b

Browse files
committed
Extend test pipelines for fips mode to java unit tests and integration
1 parent 7521575 commit 41a470b

3 files changed

Lines changed: 72 additions & 1 deletion

File tree

.buildkite/pull_request_pipeline.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ steps:
4747
diskSizeGb: 64
4848
retry:
4949
automatic:
50-
- limit: 3
50+
# dont retry on failure while they are expected
51+
- limit: 0
5152
command: |
5253
set -euo pipefail
5354
@@ -77,6 +78,30 @@ steps:
7778
- "**/jacocoTestReport.xml"
7879
- "**/build/classes/**/*.*"
7980

81+
- label: ":java: Java unit tests - FIPS mode"
82+
key: "java-unit-tests-fips"
83+
agents:
84+
provider: gcp
85+
imageProject: elastic-images-prod
86+
image: family/platform-ingest-logstash-ubuntu-2204
87+
machineType: "n2-standard-4"
88+
diskSizeGb: 64
89+
retry:
90+
automatic:
91+
# dont retry on failure while they are expected
92+
- limit: 0
93+
env:
94+
ENABLE_SONARQUBE: true
95+
command: |
96+
set -euo pipefail
97+
98+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
99+
docker run test-runner-image ./gradlew --info --stacktrace -PrunTestsInFIPSMode=true javaTests
100+
artifact_paths:
101+
- "**/build/test-results/javaTests/TEST-*.xml"
102+
- "**/jacocoTestReport.xml"
103+
- "**/build/classes/**/*.*"
104+
80105
- label: ":sonarqube: Continuous Code Inspection"
81106
if: |
82107
build.pull_request.id != null ||
@@ -98,6 +123,24 @@ steps:
98123
manual:
99124
allowed: true
100125

126+
- label: ":lab_coat: Integration Tests - FIPS mode"
127+
key: "integration-tests-fips"
128+
agents:
129+
provider: gcp
130+
imageProject: elastic-images-prod
131+
image: family/platform-ingest-logstash-ubuntu-2204
132+
machineType: "n2-standard-4"
133+
diskSizeGb: 64
134+
retry:
135+
automatic:
136+
# dont retry on failure while they are expected
137+
- limit: 0
138+
command: |
139+
set -euo pipefail
140+
141+
docker build -t test-runner-image -f x-pack/distributions/internal/observabilitySRE/docker/Dockerfile .
142+
docker run test-runner-image ./gradlew --info --stacktrace -PrunTestsInFIPSMode=true runIntegrationTests
143+
101144
- label: ":lab_coat: Integration Tests / part 1"
102145
key: "integration-tests-part-1"
103146
agents:

logstash-core/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,20 @@ tasks.register("javaTests", Test) {
124124
exclude '/org/logstash/plugins/factory/PluginFactoryExtTest.class'
125125
exclude '/org/logstash/execution/ObservedExecutionTest.class'
126126

127+
if (runTestsInFIPSMode) {
128+
systemProperty "java.security.properties", System.getenv("JAVA_SECURITY_PROPERTIES")
129+
systemProperty "javax.net.ssl.keyStore", "/etc/java/security/keystore.bcfks"
130+
systemProperty "javax.net.ssl.keyStoreType", "BCFKS"
131+
systemProperty "javax.net.ssl.keyStoreProvider", "BCFIPS"
132+
systemProperty "javax.net.ssl.keyStorePassword", "changeit"
133+
systemProperty "javax.net.ssl.trustStore", "/etc/java/security/cacerts.bcfks"
134+
systemProperty "javax.net.ssl.trustStoreType", "BCFKS"
135+
systemProperty "javax.net.ssl.trustStoreProvider", "BCFIPS"
136+
systemProperty "javax.net.ssl.trustStorePassword", "changeit"
137+
systemProperty "ssl.KeyManagerFactory.algorithm", "PKIX"
138+
systemProperty "ssl.TrustManagerFactory.algorithm", "PKIX"
139+
systemProperty "org.bouncycastle.fips.approved_only", "true"
140+
}
127141
jacoco {
128142
enabled = true
129143
destinationFile = layout.buildDirectory.file('jacoco/test.exec').get().asFile

qa/integration/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ tasks.register("integrationTests", Test) {
7272
inputs.files fileTree("${projectDir}/specs")
7373

7474
systemProperty 'logstash.root.dir', projectDir.toPath().getParent().getParent().toString()
75+
if (runTestsInFIPSMode) {
76+
systemProperty "java.security.properties", System.getenv("JAVA_SECURITY_PROPERTIES")
77+
systemProperty "javax.net.ssl.keyStore", "/etc/java/security/keystore.bcfks"
78+
systemProperty "javax.net.ssl.keyStoreType", "BCFKS"
79+
systemProperty "javax.net.ssl.keyStoreProvider", "BCFIPS"
80+
systemProperty "javax.net.ssl.keyStorePassword", "changeit"
81+
systemProperty "javax.net.ssl.trustStore", "/etc/java/security/cacerts.bcfks"
82+
systemProperty "javax.net.ssl.trustStoreType", "BCFKS"
83+
systemProperty "javax.net.ssl.trustStoreProvider", "BCFIPS"
84+
systemProperty "javax.net.ssl.trustStorePassword", "changeit"
85+
systemProperty "ssl.KeyManagerFactory.algorithm", "PKIX"
86+
systemProperty "ssl.TrustManagerFactory.algorithm", "PKIX"
87+
systemProperty "org.bouncycastle.fips.approved_only", "true"
88+
}
7589
include '/org/logstash/integration/RSpecTests.class'
7690

7791
outputs.upToDateWhen {

0 commit comments

Comments
 (0)