From a35cafa728f8be2450ce785e865e722eaad10062 Mon Sep 17 00:00:00 2001 From: skpratt Date: Wed, 7 Jun 2023 10:57:56 -0500 Subject: [PATCH] update tests for fips (#17592) --- agent/consul/merge_test.go | 2 ++ .../services/dataplane/get_supported_features_test.go | 3 +++ tlsutil/config_test.go | 2 ++ version/version.go | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/agent/consul/merge_test.go b/agent/consul/merge_test.go index 66992136aa..f5f5c6d88f 100644 --- a/agent/consul/merge_test.go +++ b/agent/consul/merge_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/consul/sdk/testutil" "github.com/hashicorp/consul/types" + "github.com/hashicorp/consul/version" ) func TestMerge_LAN(t *testing.T) { @@ -282,6 +283,7 @@ func makeTestNode(t *testing.T, tm testMember) *serf.Member { "vsn": "2", "vsn_max": "3", "vsn_min": "2", + "fips": version.GetFIPSInfo(), }, } if tm.partition != "" { diff --git a/agent/grpc-external/services/dataplane/get_supported_features_test.go b/agent/grpc-external/services/dataplane/get_supported_features_test.go index 35079a40a8..329b5df0f6 100644 --- a/agent/grpc-external/services/dataplane/get_supported_features_test.go +++ b/agent/grpc-external/services/dataplane/get_supported_features_test.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/consul/agent/grpc-external/testutils" structs "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/proto-public/pbdataplane" + "github.com/hashicorp/consul/version" ) const testACLToken = "acl-token" @@ -50,6 +51,8 @@ func TestSupportedDataplaneFeatures_Success(t *testing.T) { require.True(t, feature.GetSupported()) case pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_ENVOY_BOOTSTRAP_CONFIGURATION: require.True(t, feature.GetSupported()) + case pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_FIPS: + require.Equal(t, version.IsFIPS(), feature.GetSupported()) default: require.False(t, feature.GetSupported()) } diff --git a/tlsutil/config_test.go b/tlsutil/config_test.go index 18ba11e38b..30ebd62c20 100644 --- a/tlsutil/config_test.go +++ b/tlsutil/config_test.go @@ -1,5 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 +//go:build !fips +// +build !fips package tlsutil diff --git a/version/version.go b/version/version.go index bd2cfd57aa..0b81e19d2b 100644 --- a/version/version.go +++ b/version/version.go @@ -52,6 +52,10 @@ func GetHumanVersion() string { version += fmt.Sprintf("-%s", release) } + if IsFIPS() { + version += ".fips1402" + } + if metadata != "" { version += fmt.Sprintf("+%s", metadata) }