Skip to content

Commit

Permalink
rename testing_util.go to testing_util_stubs_oss.go and move init Bui…
Browse files Browse the repository at this point in the history
…ldDate to new shared testing_util.go
  • Loading branch information
helenfufu committed Dec 4, 2024
1 parent ceb7506 commit 0f140bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
15 changes: 0 additions & 15 deletions vault/testing_util.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// 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"
Expand All @@ -20,11 +13,3 @@ func init() {
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) {}
30 changes: 30 additions & 0 deletions vault/testing_util_stubs_oss.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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"
)

func init() {
// The BuildDate is set as part of the build process in CI so we need to
// initialize it for testing.
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) {}

0 comments on commit 0f140bf

Please sign in to comment.