From 0affe226addc40e07ac16c0b54e5800557d570bf Mon Sep 17 00:00:00 2001 From: Christopher Swenson Date: Thu, 5 May 2022 10:30:40 -0700 Subject: [PATCH] Update deps for consul-template 0.29.0 (#15293) This requires bumping https://github.com/mitchellh/go-testing-interface. For this new version, we have to create a wrapper to convert the stdlib `testing.TB` interface to the `mitchellh/go-testing-interface` `T` interface, since it uses `Parallel()` now, which is not supported by `testing.TB`. This had to be added to a new package, `benchhelpers`, to avoid a circular dependency in `testhelpers`. We also have to *unbump* https://github.com/armon/go-metrics since updating it breaks our usage of https://github.com/google/go-metrics-stackdriver I verified that the new `pkiCert` template function works with agent injection using annotations like: ```yaml vault.hashicorp.com/agent-inject-secret-sample.crt: "pki/issue/example-dot-com" vault.hashicorp.com/agent-inject-template-sample.crt: | {{ pkiCert "pki/issue/example-dot-com" "common_name=foo.example.com" "ttl=1h" }} ``` --- changelog/15293.txt | 3 +++ command/command_test.go | 5 +++-- go.mod | 10 +++++----- go.sum | 20 +++++++++---------- helper/benchhelpers/benchhelpers.go | 19 ++++++++++++++++++ http/forwarding_bench_test.go | 5 +++-- http/plugin_test.go | 7 ++++--- vault/expiration_test.go | 13 ++++++------ .../api/api_integration_test.go | 5 +++-- vault/external_tests/raft/raft_test.go | 5 +++-- vault/token_store_test.go | 7 ++++--- 11 files changed, 64 insertions(+), 35 deletions(-) create mode 100644 changelog/15293.txt create mode 100644 helper/benchhelpers/benchhelpers.go diff --git a/changelog/15293.txt b/changelog/15293.txt new file mode 100644 index 000000000..857b19886 --- /dev/null +++ b/changelog/15293.txt @@ -0,0 +1,3 @@ +```release-note:improvement +agent: Update consult-template to v0.29.0 +``` \ No newline at end of file diff --git a/command/command_test.go b/command/command_test.go index 8de036e40..f3249f2b5 100644 --- a/command/command_test.go +++ b/command/command_test.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/vault/builtin/logical/pki" "github.com/hashicorp/vault/builtin/logical/ssh" "github.com/hashicorp/vault/builtin/logical/transit" + "github.com/hashicorp/vault/helper/benchhelpers" "github.com/hashicorp/vault/helper/builtinplugins" "github.com/hashicorp/vault/sdk/helper/logging" "github.com/hashicorp/vault/sdk/logical" @@ -125,7 +126,7 @@ func testVaultServerPluginDir(tb testing.TB, pluginDir string) (*api.Client, []s func testVaultServerCoreConfig(tb testing.TB, coreConfig *vault.CoreConfig) (*api.Client, []string, func()) { tb.Helper() - cluster := vault.NewTestCluster(tb, coreConfig, &vault.TestClusterOptions{ + cluster := vault.NewTestCluster(benchhelpers.TBtoT(tb), coreConfig, &vault.TestClusterOptions{ HandlerFunc: vaulthttp.Handler, NumCores: 1, // Default is 3, but we don't need that many }) @@ -133,7 +134,7 @@ func testVaultServerCoreConfig(tb testing.TB, coreConfig *vault.CoreConfig) (*ap // Make it easy to get access to the active core := cluster.Cores[0].Core - vault.TestWaitActive(tb, core) + vault.TestWaitActive(benchhelpers.TBtoT(tb), core) // Get the client already setup for us! client := cluster.Cores[0].Client diff --git a/go.mod b/go.mod index f1915bfc4..d8b6df885 100644 --- a/go.mod +++ b/go.mod @@ -55,7 +55,7 @@ require ( github.com/google/go-github v17.0.0+incompatible github.com/google/go-metrics-stackdriver v0.2.0 github.com/hashicorp/cap v0.1.1 - github.com/hashicorp/consul-template v0.28.1-0.20220415203157-ebf2f3dfe745 + github.com/hashicorp/consul-template v0.29.0 github.com/hashicorp/consul/api v1.12.0 github.com/hashicorp/errwrap v1.1.0 github.com/hashicorp/go-cleanhttp v0.5.2 @@ -86,7 +86,7 @@ require ( github.com/hashicorp/go-version v1.4.0 github.com/hashicorp/golang-lru v0.5.4 github.com/hashicorp/hcl v1.0.1-vault-3 - github.com/hashicorp/nomad/api v0.0.0-20211006193434-215bf04bc650 + github.com/hashicorp/nomad/api v0.0.0-20220407202126-2eba643965c4 github.com/hashicorp/raft v1.3.9 github.com/hashicorp/raft-autopilot v0.1.3 github.com/hashicorp/raft-boltdb/v2 v2.0.0-20210421194847-a7e34179d62c @@ -136,7 +136,7 @@ require ( github.com/mitchellh/cli v1.1.2 github.com/mitchellh/copystructure v1.2.0 github.com/mitchellh/go-homedir v1.1.0 - github.com/mitchellh/go-testing-interface v1.14.0 + github.com/mitchellh/go-testing-interface v1.14.1 github.com/mitchellh/go-wordwrap v1.0.0 github.com/mitchellh/gox v1.0.1 github.com/mitchellh/mapstructure v1.4.3 @@ -162,7 +162,7 @@ require ( github.com/sasha-s/go-deadlock v0.2.0 github.com/sethvargo/go-limiter v0.7.1 github.com/shirou/gopsutil v3.21.5+incompatible - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.etcd.io/bbolt v1.3.6 go.etcd.io/etcd/client/pkg/v3 v3.5.0 go.etcd.io/etcd/client/v2 v2.305.0 @@ -280,7 +280,7 @@ require ( github.com/gophercloud/gophercloud v0.1.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect - github.com/hashicorp/cronexpr v1.1.0 // indirect + github.com/hashicorp/cronexpr v1.1.1 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-kms-wrapping/entropy v0.1.0 // indirect github.com/hashicorp/go-slug v0.7.0 // indirect diff --git a/go.sum b/go.sum index 4588d1f69..1591952fe 100644 --- a/go.sum +++ b/go.sum @@ -783,7 +783,6 @@ github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7Fsg github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gotestyourself/gotestyourself v2.2.0+incompatible h1:AQwinXlbQR2HvPjQZOmDhRqsv5mZf+Jb1RnSLxcqZcI= @@ -800,8 +799,8 @@ github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/cap v0.1.1 h1:GjO4+9+H0wv/89YoEsxeVc2jIizL19r5v5l2lpaH8Kg= github.com/hashicorp/cap v0.1.1/go.mod h1:VfBvK2ULRyqsuqAnjgZl7HJ7/CGMC7ro4H5eXiZuun8= -github.com/hashicorp/consul-template v0.28.1-0.20220415203157-ebf2f3dfe745 h1:91lxOf6Uo92mXbCR7s9IcHk2iqOngdZrqsvH4gZHqcs= -github.com/hashicorp/consul-template v0.28.1-0.20220415203157-ebf2f3dfe745/go.mod h1:324C5f8AHp6JqhyfZcX4JsguFdNkKIpZvjZyeCf5W4w= +github.com/hashicorp/consul-template v0.29.0 h1:rDmF3Wjqp5ztCq054MruzEpi9ArcyJ/Rp4eWrDhMldM= +github.com/hashicorp/consul-template v0.29.0/go.mod h1:p1A8Z6Mz7gbXu38SI1c9nt5ItBK7ACWZG4ZE1A5Tr2M= github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= github.com/hashicorp/consul/api v1.12.0 h1:k3y1FYv6nuKyNTqj6w9gXOx5r5CfLj/k/euUeBXj1OY= github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= @@ -810,8 +809,8 @@ github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPA github.com/hashicorp/consul/sdk v0.4.1-0.20200910203702-bb2b5dd871ca/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= github.com/hashicorp/consul/sdk v0.8.0 h1:OJtKBtEjboEZvG6AOUdh4Z1Zbyu0WcxQ0qatRrZHTVU= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/cronexpr v1.1.0 h1:dnNsWtH0V2ReN7JccYe8m//Bj14+PjJDntR1dz0Cixk= -github.com/hashicorp/cronexpr v1.1.0/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= +github.com/hashicorp/cronexpr v1.1.1 h1:NJZDd87hGXjoZBdvyCF9mX4DCq5Wy7+A/w+A7q0wn6c= +github.com/hashicorp/cronexpr v1.1.1/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= @@ -932,8 +931,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/memberlist v0.3.0 h1:8+567mCcFDnS5ADl7lrpxPMWiFCElyUEeW0gtj34fMA= github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/nomad/api v0.0.0-20211006193434-215bf04bc650 h1:pSi8Q6BuijRU9vK/b4/evBeDMXSFBlOX5CTUo3iY4HY= -github.com/hashicorp/nomad/api v0.0.0-20211006193434-215bf04bc650/go.mod h1:vYHP9jMXk4/T2qNUbWlQ1OHCA1hHLil3nvqSmz8mtgc= +github.com/hashicorp/nomad/api v0.0.0-20220407202126-2eba643965c4 h1:jwap3v+Yu5XvBXEX0r36km2rqAsXqEbGogTTwT5FgZM= +github.com/hashicorp/nomad/api v0.0.0-20220407202126-2eba643965c4/go.mod h1:b/AoT79m3PEpb6tKCFKva/M+q1rKJNUk5mdu1S8DymM= github.com/hashicorp/raft v1.0.1/go.mod h1:DVSAWItjLjTOkVbSpWQ0j0kUADIvDaCtBxIcbNAQLkI= github.com/hashicorp/raft v1.1.0/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM= github.com/hashicorp/raft v1.1.2-0.20191002163536-9c6bd3e3eb17/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8= @@ -1186,8 +1185,9 @@ github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.14.0 h1:/x0XQ6h+3U3nAyk1yx+bHPURrKa9sVVvYbuqZ7pIAtI= github.com/mitchellh/go-testing-interface v1.14.0/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= @@ -1199,7 +1199,6 @@ github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWe github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= @@ -1509,8 +1508,9 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= diff --git a/helper/benchhelpers/benchhelpers.go b/helper/benchhelpers/benchhelpers.go new file mode 100644 index 000000000..9c0feac15 --- /dev/null +++ b/helper/benchhelpers/benchhelpers.go @@ -0,0 +1,19 @@ +package benchhelpers + +import ( + "testing" + + testinginterface "github.com/mitchellh/go-testing-interface" +) + +type tbWrapper struct { + testing.TB +} + +func (b tbWrapper) Parallel() { + // no-op +} + +func TBtoT(tb testing.TB) testinginterface.T { + return tbWrapper{tb} +} diff --git a/http/forwarding_bench_test.go b/http/forwarding_bench_test.go index 074318156..f7334058d 100644 --- a/http/forwarding_bench_test.go +++ b/http/forwarding_bench_test.go @@ -11,6 +11,7 @@ import ( log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/builtin/logical/transit" + "github.com/hashicorp/vault/helper/benchhelpers" "github.com/hashicorp/vault/helper/forwarding" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/logging" @@ -28,7 +29,7 @@ func BenchmarkHTTP_Forwarding_Stress(b *testing.B) { }, } - cluster := vault.NewTestCluster(b, coreConfig, &vault.TestClusterOptions{ + cluster := vault.NewTestCluster(benchhelpers.TBtoT(b), coreConfig, &vault.TestClusterOptions{ HandlerFunc: Handler, Logger: logging.NewVaultLoggerWithWriter(ioutil.Discard, log.Error), }) @@ -38,7 +39,7 @@ func BenchmarkHTTP_Forwarding_Stress(b *testing.B) { // make it easy to get access to the active core := cores[0].Core - vault.TestWaitActive(b, core) + vault.TestWaitActive(benchhelpers.TBtoT(b), core) handler := cores[0].Handler host := fmt.Sprintf("https://127.0.0.1:%d/v1/transit/", cores[0].Listeners[0].Address.Port) diff --git a/http/plugin_test.go b/http/plugin_test.go index 469fcf0d8..9aa838b48 100644 --- a/http/plugin_test.go +++ b/http/plugin_test.go @@ -11,6 +11,7 @@ import ( log "github.com/hashicorp/go-hclog" "github.com/hashicorp/vault/api" bplugin "github.com/hashicorp/vault/builtin/plugin" + "github.com/hashicorp/vault/helper/benchhelpers" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/pluginutil" "github.com/hashicorp/vault/sdk/logical" @@ -40,7 +41,7 @@ func getPluginClusterAndCore(t testing.TB, logger log.Logger) (*vault.TestCluste }, } - cluster := vault.NewTestCluster(t, coreConfig, &vault.TestClusterOptions{ + cluster := vault.NewTestCluster(benchhelpers.TBtoT(t), coreConfig, &vault.TestClusterOptions{ HandlerFunc: Handler, Logger: logger.Named("testclusteroptions"), }) @@ -51,8 +52,8 @@ func getPluginClusterAndCore(t testing.TB, logger log.Logger) (*vault.TestCluste os.Setenv(pluginutil.PluginCACertPEMEnv, cluster.CACertPEMFile) - vault.TestWaitActive(t, core.Core) - vault.TestAddTestPlugin(t, core.Core, "mock-plugin", consts.PluginTypeSecrets, "TestPlugin_PluginMain", []string{}, "") + vault.TestWaitActive(benchhelpers.TBtoT(t), core.Core) + vault.TestAddTestPlugin(benchhelpers.TBtoT(t), core.Core, "mock-plugin", consts.PluginTypeSecrets, "TestPlugin_PluginMain", []string{}, "") // Mount the mock plugin err = core.Client.Sys().Mount("mock", &api.MountInput{ diff --git a/vault/expiration_test.go b/vault/expiration_test.go index af82a34cf..84a8e0076 100644 --- a/vault/expiration_test.go +++ b/vault/expiration_test.go @@ -14,9 +14,10 @@ import ( "testing" "time" - metrics "github.com/armon/go-metrics" + "github.com/armon/go-metrics" log "github.com/hashicorp/go-hclog" - uuid "github.com/hashicorp/go-uuid" + "github.com/hashicorp/go-uuid" + "github.com/hashicorp/vault/helper/benchhelpers" "github.com/hashicorp/vault/helper/fairshare" "github.com/hashicorp/vault/helper/metricsutil" "github.com/hashicorp/vault/helper/namespace" @@ -31,7 +32,7 @@ var testImagePull sync.Once // mockExpiration returns a mock expiration manager func mockExpiration(t testing.TB) *ExpirationManager { - c, _, _ := TestCoreUnsealed(t) + c, _, _ := TestCoreUnsealed(benchhelpers.TBtoT(t)) // Wait until the expiration manager is out of restore mode. // This was added to prevent sporadic failures of TestExpiration_unrecoverableErrorMakesIrrevocable. @@ -47,7 +48,7 @@ func mockExpiration(t testing.TB) *ExpirationManager { } func mockBackendExpiration(t testing.TB, backend physical.Backend) (*Core, *ExpirationManager) { - c, _, _ := TestCoreUnsealedBackend(t, backend) + c, _, _ := TestCoreUnsealedBackend(benchhelpers.TBtoT(t), backend) return c, c.expiration } @@ -598,7 +599,7 @@ func BenchmarkExpiration_Restore_InMem(b *testing.B) { } func benchmarkExpirationBackend(b *testing.B, physicalBackend physical.Backend, numLeases int) { - c, _, _ := TestCoreUnsealedBackend(b, physicalBackend) + c, _, _ := TestCoreUnsealedBackend(benchhelpers.TBtoT(b), physicalBackend) exp := c.expiration noop := &NoopBackend{} view := NewBarrierView(c.barrier, "logical/") @@ -665,7 +666,7 @@ func BenchmarkExpiration_Create_Leases(b *testing.B) { b.Fatal(err) } - c, _, _ := TestCoreUnsealedBackend(b, inm) + c, _, _ := TestCoreUnsealedBackend(benchhelpers.TBtoT(b), inm) exp := c.expiration noop := &NoopBackend{} view := NewBarrierView(c.barrier, "logical/") diff --git a/vault/external_tests/api/api_integration_test.go b/vault/external_tests/api/api_integration_test.go index 7647e5ec4..ffa0ed6e4 100644 --- a/vault/external_tests/api/api_integration_test.go +++ b/vault/external_tests/api/api_integration_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/vault/builtin/logical/database" "github.com/hashicorp/vault/builtin/logical/pki" "github.com/hashicorp/vault/builtin/logical/transit" + "github.com/hashicorp/vault/helper/benchhelpers" "github.com/hashicorp/vault/helper/builtinplugins" "github.com/hashicorp/vault/http" "github.com/hashicorp/vault/sdk/logical" @@ -57,14 +58,14 @@ func testVaultServerUnseal(t testing.TB) (*api.Client, []string, func()) { func testVaultServerCoreConfig(t testing.TB, coreConfig *vault.CoreConfig) (*api.Client, []string, func()) { t.Helper() - cluster := vault.NewTestCluster(t, coreConfig, &vault.TestClusterOptions{ + cluster := vault.NewTestCluster(benchhelpers.TBtoT(t), coreConfig, &vault.TestClusterOptions{ HandlerFunc: http.Handler, }) cluster.Start() // Make it easy to get access to the active core := cluster.Cores[0].Core - vault.TestWaitActive(t, core) + vault.TestWaitActive(benchhelpers.TBtoT(t), core) // Get the client already setup for us! client := cluster.Cores[0].Client diff --git a/vault/external_tests/raft/raft_test.go b/vault/external_tests/raft/raft_test.go index 967cd1507..31a2afff4 100644 --- a/vault/external_tests/raft/raft_test.go +++ b/vault/external_tests/raft/raft_test.go @@ -15,6 +15,7 @@ import ( "testing" "time" + "github.com/hashicorp/vault/helper/benchhelpers" vaultseal "github.com/hashicorp/vault/vault/seal" "github.com/hashicorp/go-cleanhttp" @@ -73,9 +74,9 @@ func raftCluster(t testing.TB, ropts *RaftClusterOpts) *vault.TestCluster { opts.SetupFunc = nil } - cluster := vault.NewTestCluster(t, conf, &opts) + cluster := vault.NewTestCluster(benchhelpers.TBtoT(t), conf, &opts) cluster.Start() - vault.TestWaitActive(t, cluster.Cores[0].Core) + vault.TestWaitActive(benchhelpers.TBtoT(t), cluster.Cores[0].Core) return cluster } diff --git a/vault/token_store_test.go b/vault/token_store_test.go index 011ac641b..d3a7d6557 100644 --- a/vault/token_store_test.go +++ b/vault/token_store_test.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/go-sockaddr" "github.com/hashicorp/go-uuid" + "github.com/hashicorp/vault/helper/benchhelpers" "github.com/hashicorp/vault/helper/identity" "github.com/hashicorp/vault/helper/metricsutil" "github.com/hashicorp/vault/helper/namespace" @@ -525,7 +526,7 @@ func testMakeServiceTokenViaBackend(t testing.TB, ts *TokenStore, root, client, func testMakeTokenViaBackend(t testing.TB, ts *TokenStore, root, client, ttl string, policy []string, batch bool) { t.Helper() - req := logical.TestRequest(t, logical.UpdateOperation, "create") + req := logical.TestRequest(benchhelpers.TBtoT(t), logical.UpdateOperation, "create") req.ClientToken = root if batch { req.Data["type"] = "batch" @@ -635,7 +636,7 @@ func testMakeServiceTokenViaCore(t testing.TB, c *Core, root, client, ttl string } func testMakeTokenViaCore(t testing.TB, c *Core, root, client, ttl, period string, policy []string, batch bool, outAuth *logical.Auth) { - req := logical.TestRequest(t, logical.UpdateOperation, "auth/token/create") + req := logical.TestRequest(benchhelpers.TBtoT(t), logical.UpdateOperation, "auth/token/create") req.ClientToken = root if batch { req.Data["type"] = "batch" @@ -1394,7 +1395,7 @@ func TestTokenStore_RevokeTree(t *testing.T) { // Revokes a given Token Store tree non recursively. // The second parameter refers to the depth of the tree. func testTokenStore_RevokeTree_NonRecursive(t testing.TB, depth uint64, injectCycles bool) { - c, _, _ := TestCoreUnsealed(t) + c, _, _ := TestCoreUnsealed(benchhelpers.TBtoT(t)) ts := c.tokenStore root, children := buildTokenTree(t, ts, depth)