Skip to content

Commit 8e304bd

Browse files
Add go1.24 GODEBUG=fips140=only test (#4581)
Add a new target that uses GODEBUG=fips140=only to run unit tests. This target should use the FIPS=true flag in order to pass -tags=requirefips.
1 parent b62afa5 commit 8e304bd

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

.buildkite/pipeline.yml

+11
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ steps:
8787
- build/*.xml
8888
- build/coverage*.out
8989

90+
- label: ":smartbear-testexecute: Run FIPS unit tests"
91+
key: unit-test-fips
92+
command: ".buildkite/scripts/unit_test.sh"
93+
env:
94+
FIPS: "true"
95+
agents:
96+
provider: "gcp"
97+
artifact_paths:
98+
- build/*.xml
99+
- build/coverage*.out
100+
90101
- label: ":smartbear-testexecute: Run unit tests: MacOS 13"
91102
key: unit-test-macos-13
92103
command: ".buildkite/scripts/unit_test.sh"

.buildkite/scripts/unit_test.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ add_bin_path
99
with_go
1010

1111
echo "Starting the unit tests..."
12-
make test-unit junit-report
12+
if [[ ${FIPS:-} == "true" ]]; then
13+
make test-unit-fips junit-report
14+
else
15+
make test-unit junit-report
16+
fi

Makefile

+8-1
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,16 @@ test: prepare-test-context ## - Run all tests
221221
test-release: ## - Check that all release binaries are created
222222
./.buildkite/scripts/test-release.sh $(DEFAULT_VERSION)
223223

224+
# If FIPS=true unit tests need microsoft/go + OpenSSL with FIPS
224225
.PHONY: test-unit
225226
test-unit: prepare-test-context ## - Run unit tests only
226-
set -o pipefail; go test ${GO_TEST_FLAG} -tags=$(GOBUILDTAGS) -v -race -coverprofile=build/coverage-${OS_NAME}.out ./... | tee build/test-unit-${OS_NAME}.out
227+
set -o pipefail; ${GOFIPSEXPERIMENT} go test ${GO_TEST_FLAG} -tags=$(GOBUILDTAGS) -v -race -coverprofile=build/coverage-${OS_NAME}.out ./... | tee build/test-unit-${OS_NAME}.out
228+
229+
# FIPS unit tests are meant to use go v1.24 to check FIPS compliance.
230+
# This check is very strict, and should be thought of as a static-code analysis tool.
231+
.PHONY: test-unit-fips
232+
test-unit-fips: prepare-test-context ## - Run unit tests with go 1.24's fips140=only for testing
233+
set -o pipefail; GOFIPS140=latest GODEBUG=fips140=only go test ${GO_TEST_FLAG} -tags=$(GOBUILDTAGS) -v -race -coverprofile=build/coverage-${OS_NAME}.out ./... | tee build/test-unit-fips-${OS_NAME}.out
227234

228235
.PHONY: benchmark
229236
benchmark: prepare-test-context install-benchstat ## - Run benchmark tests only

0 commit comments

Comments
 (0)