mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
testing: set MetricsHelper if it not provided through base config (#7480)
This commit is contained in:
parent
3c53db300b
commit
16bc4a4fa6
1 changed files with 8 additions and 0 deletions
|
|
@ -27,8 +27,10 @@ import (
|
|||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/armon/go-metrics"
|
||||
hclog "github.com/hashicorp/go-hclog"
|
||||
log "github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/vault/helper/metricsutil"
|
||||
"github.com/mitchellh/copystructure"
|
||||
|
||||
"golang.org/x/crypto/ed25519"
|
||||
|
|
@ -1488,6 +1490,12 @@ func NewTestCluster(t testing.T, base *CoreConfig, opts *TestClusterOptions) *Te
|
|||
localConfig.LicensingConfig = testGetLicensingConfig(pubKey)
|
||||
}
|
||||
|
||||
if localConfig.MetricsHelper == nil {
|
||||
inm := metrics.NewInmemSink(10*time.Second, time.Minute)
|
||||
metrics.DefaultInmemSignal(inm)
|
||||
localConfig.MetricsHelper = metricsutil.NewMetricsHelper(inm, false)
|
||||
}
|
||||
|
||||
c, err := NewCore(&localConfig)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue