update tests for fips (#17592)

This commit is contained in:
skpratt 2023-06-07 10:57:56 -05:00 committed by GitHub
parent 08f9cd1678
commit eaed8c55c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/hashicorp/consul/sdk/testutil" "github.com/hashicorp/consul/sdk/testutil"
"github.com/hashicorp/consul/types" "github.com/hashicorp/consul/types"
"github.com/hashicorp/consul/version"
) )
func TestMerge_LAN(t *testing.T) { func TestMerge_LAN(t *testing.T) {
@ -282,6 +283,7 @@ func makeTestNode(t *testing.T, tm testMember) *serf.Member {
"vsn": "2", "vsn": "2",
"vsn_max": "3", "vsn_max": "3",
"vsn_min": "2", "vsn_min": "2",
"fips": version.GetFIPSInfo(),
}, },
} }
if tm.partition != "" { if tm.partition != "" {

View File

@ -19,6 +19,7 @@ import (
"github.com/hashicorp/consul/agent/grpc-external/testutils" "github.com/hashicorp/consul/agent/grpc-external/testutils"
structs "github.com/hashicorp/consul/agent/structs" structs "github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/proto-public/pbdataplane" "github.com/hashicorp/consul/proto-public/pbdataplane"
"github.com/hashicorp/consul/version"
) )
const testACLToken = "acl-token" const testACLToken = "acl-token"
@ -50,6 +51,8 @@ func TestSupportedDataplaneFeatures_Success(t *testing.T) {
require.True(t, feature.GetSupported()) require.True(t, feature.GetSupported())
case pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_ENVOY_BOOTSTRAP_CONFIGURATION: case pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_ENVOY_BOOTSTRAP_CONFIGURATION:
require.True(t, feature.GetSupported()) require.True(t, feature.GetSupported())
case pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_FIPS:
require.Equal(t, version.IsFIPS(), feature.GetSupported())
default: default:
require.False(t, feature.GetSupported()) require.False(t, feature.GetSupported())
} }

View File

@ -1,5 +1,7 @@
// Copyright (c) HashiCorp, Inc. // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
//go:build !fips
// +build !fips
package tlsutil package tlsutil

View File

@ -52,6 +52,10 @@ func GetHumanVersion() string {
version += fmt.Sprintf("-%s", release) version += fmt.Sprintf("-%s", release)
} }
if IsFIPS() {
version += ".fips1402"
}
if metadata != "" { if metadata != "" {
version += fmt.Sprintf("+%s", metadata) version += fmt.Sprintf("+%s", metadata)
} }