Skip to content

Commit 49f8ce4

Browse files
committed
rename testing_util.go to testing_util_stubs_oss.go and move init BuildDate to new shared testing_util.go
1 parent ceb7506 commit 49f8ce4

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

vault/testing_util.go

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: BUSL-1.1
33

4-
//go:build !enterprise
5-
64
package vault
75

86
import (
9-
"crypto/ed25519"
10-
"testing"
117
"time"
128

139
"github.com/hashicorp/vault/version"
1410
)
1511

1612
func init() {
1713
// The BuildDate is set as part of the build process in CI so we need to
18-
// initialize it for testing.
14+
// initialize it for testing. By setting it to now minus one year we
15+
// provide some headroom to ensure that test license expiration (for enterprise)
16+
// does not exceed the BuildDate as that is invalid.
1917
if version.BuildDate == "" {
2018
version.BuildDate = time.Now().UTC().AddDate(-1, 0, 0).Format(time.RFC3339)
2119
}
2220
}
23-
24-
func GenerateTestLicenseKeys() (ed25519.PublicKey, ed25519.PrivateKey, error) { return nil, nil, nil }
25-
func testGetLicensingConfig(key ed25519.PublicKey) *LicensingConfig { return &LicensingConfig{} }
26-
func testExtraTestCoreSetup(testing.TB, ed25519.PrivateKey, *TestClusterCore) {}
27-
func testAdjustUnderlyingStorage(tcc *TestClusterCore) {
28-
tcc.UnderlyingStorage = tcc.physical
29-
}
30-
func testApplyEntBaseConfig(coreConfig, base *CoreConfig) {}

vault/testing_util_stubs_oss.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: BUSL-1.1
3+
4+
//go:build !enterprise
5+
6+
package vault
7+
8+
import (
9+
"crypto/ed25519"
10+
"testing"
11+
)
12+
13+
func GenerateTestLicenseKeys() (ed25519.PublicKey, ed25519.PrivateKey, error) { return nil, nil, nil }
14+
func testGetLicensingConfig(key ed25519.PublicKey) *LicensingConfig { return &LicensingConfig{} }
15+
func testExtraTestCoreSetup(testing.TB, ed25519.PrivateKey, *TestClusterCore) {}
16+
func testAdjustUnderlyingStorage(tcc *TestClusterCore) {
17+
tcc.UnderlyingStorage = tcc.physical
18+
}
19+
func testApplyEntBaseConfig(coreConfig, base *CoreConfig) {}

0 commit comments

Comments
 (0)