diff --git a/vault/testing_util.go b/vault/testing_util.go index 0e5ec52d38287..980b214619d4e 100644 --- a/vault/testing_util.go +++ b/vault/testing_util.go @@ -1,13 +1,9 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: BUSL-1.1 -//go:build !enterprise - package vault import ( - "crypto/ed25519" - "testing" "time" "github.com/hashicorp/vault/version" @@ -15,16 +11,10 @@ import ( func init() { // The BuildDate is set as part of the build process in CI so we need to - // initialize it for testing. + // initialize it for testing. By setting it to now minus one year we + // provide some headroom to ensure that test license expiration (for enterprise) + // does not exceed the BuildDate as that is invalid. if version.BuildDate == "" { version.BuildDate = time.Now().UTC().AddDate(-1, 0, 0).Format(time.RFC3339) } } - -func GenerateTestLicenseKeys() (ed25519.PublicKey, ed25519.PrivateKey, error) { return nil, nil, nil } -func testGetLicensingConfig(key ed25519.PublicKey) *LicensingConfig { return &LicensingConfig{} } -func testExtraTestCoreSetup(testing.TB, ed25519.PrivateKey, *TestClusterCore) {} -func testAdjustUnderlyingStorage(tcc *TestClusterCore) { - tcc.UnderlyingStorage = tcc.physical -} -func testApplyEntBaseConfig(coreConfig, base *CoreConfig) {} diff --git a/vault/testing_util_stubs_oss.go b/vault/testing_util_stubs_oss.go new file mode 100644 index 0000000000000..0aff91c60c044 --- /dev/null +++ b/vault/testing_util_stubs_oss.go @@ -0,0 +1,19 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +//go:build !enterprise + +package vault + +import ( + "crypto/ed25519" + "testing" +) + +func GenerateTestLicenseKeys() (ed25519.PublicKey, ed25519.PrivateKey, error) { return nil, nil, nil } +func testGetLicensingConfig(key ed25519.PublicKey) *LicensingConfig { return &LicensingConfig{} } +func testExtraTestCoreSetup(testing.TB, ed25519.PrivateKey, *TestClusterCore) {} +func testAdjustUnderlyingStorage(tcc *TestClusterCore) { + tcc.UnderlyingStorage = tcc.physical +} +func testApplyEntBaseConfig(coreConfig, base *CoreConfig) {}