backport deps: remove Vault SDK into release/1.6.x (#18727)

Co-authored-by: Tim Gross <tgross@hashicorp.com>
This commit is contained in:
hc-github-team-nomad-core 2023-10-11 11:02:48 -05:00 committed by GitHub
parent 60747ed93d
commit f6900307e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 11 deletions

View File

@ -15,12 +15,13 @@ import (
"github.com/hashicorp/nomad/helper/useragent"
"github.com/hashicorp/nomad/testutil"
vaultapi "github.com/hashicorp/vault/api"
vaultconsts "github.com/hashicorp/vault/sdk/helper/consts"
"github.com/shoenig/test/must"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const vaultNamespaceHeaderName = "X-Vault-Namespace"
func TestVaultClient_TokenRenewals(t *testing.T) {
ci.Parallel(t)
@ -125,7 +126,7 @@ func TestVaultClient_NamespaceSupport(t *testing.T) {
conf.VaultConfig.Namespace = testNs
c, err := NewVaultClient(conf.VaultConfig, logger, nil)
require.NoError(err)
require.Equal(testNs, c.client.Headers().Get(vaultconsts.NamespaceHeaderName))
require.Equal(testNs, c.client.Headers().Get(vaultNamespaceHeaderName))
}
func TestVaultClient_Heap(t *testing.T) {

1
go.mod
View File

@ -82,7 +82,6 @@ require (
github.com/hashicorp/raft-boltdb/v2 v2.2.2
github.com/hashicorp/serf v0.10.1
github.com/hashicorp/vault/api v1.9.1
github.com/hashicorp/vault/sdk v0.9.0
github.com/hashicorp/yamux v0.1.1
github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745
github.com/kr/pretty v0.3.1

2
go.sum
View File

@ -939,8 +939,6 @@ github.com/hashicorp/vault/api v1.9.1/go.mod h1:78kktNcQYbBGSrOjQfHjXN32OhhxXnbY
github.com/hashicorp/vault/api/auth/kubernetes v0.3.0 h1:HkaCmTKzcgLa2tjdiAid1rbmyQNmQGHfnmvIIM2WorY=
github.com/hashicorp/vault/api/auth/kubernetes v0.3.0/go.mod h1:l1B4MGtLc+P37MabBQiIhP3qd9agj0vqhETmaQjjC/Y=
github.com/hashicorp/vault/sdk v0.6.0/go.mod h1:+DRpzoXIdMvKc88R4qxr+edwy/RvH5QK8itmxLiDHLc=
github.com/hashicorp/vault/sdk v0.9.0 h1:Cbu9ezaZafZTXnen98QKVmufEPquhZ+r1ORZ7csNLFU=
github.com/hashicorp/vault/sdk v0.9.0/go.mod h1:VX9d+xF62YBNtiEc4l3Z2aea9HVtAS49EoniuXzHtC4=
github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443 h1:O/pT5C1Q3mVXMyuqg7yuAWUg/jMZR1/0QTzTRdNR6Uw=
github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443/go.mod h1:bEpDU35nTu0ey1EXjwNwPjI9xErAsoOCmcMb9GKvyxo=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=

View File

@ -18,7 +18,6 @@ import (
"github.com/hashicorp/nomad/ci"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/time/rate"
"github.com/hashicorp/nomad/helper/pointer"
@ -29,7 +28,6 @@ import (
"github.com/hashicorp/nomad/nomad/structs/config"
"github.com/hashicorp/nomad/testutil"
vapi "github.com/hashicorp/vault/api"
vaultconsts "github.com/hashicorp/vault/sdk/helper/consts"
)
const (
@ -73,6 +71,8 @@ path "secret/*" {
capabilities = ["create", "read", "update", "delete", "list"]
}
`
vaultNamespaceHeaderName = "X-Vault-Namespace"
)
// defaultTestVaultAllowlistRoleAndToken creates a test Vault role and returns a token
@ -202,8 +202,8 @@ func TestVaultClient_WithNamespaceSupport(t *testing.T) {
t.Fatalf("failed to build vault client: %v", err)
}
require.Equal(testNs, c.client.Headers().Get(vaultconsts.NamespaceHeaderName))
require.Equal("", c.clientSys.Headers().Get(vaultconsts.NamespaceHeaderName))
require.Equal(testNs, c.client.Headers().Get(vaultNamespaceHeaderName))
require.Equal("", c.clientSys.Headers().Get(vaultNamespaceHeaderName))
require.NotEqual(c.clientSys, c.client)
}
@ -227,8 +227,8 @@ func TestVaultClient_WithoutNamespaceSupport(t *testing.T) {
t.Fatalf("failed to build vault client: %v", err)
}
require.Equal("", c.client.Headers().Get(vaultconsts.NamespaceHeaderName))
require.Equal("", c.clientSys.Headers().Get(vaultconsts.NamespaceHeaderName))
require.Equal("", c.client.Headers().Get(vaultNamespaceHeaderName))
require.Equal("", c.clientSys.Headers().Get(vaultNamespaceHeaderName))
require.Equal(c.clientSys, c.client)
}