Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: remove Vault SDK #18725

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/vaultclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ 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/require"
)

const vaultNamespaceHeaderName = "X-Vault-Namespace"

func TestVaultClient_TokenRenewals(t *testing.T) {
ci.Parallel(t)

Expand Down Expand Up @@ -123,7 +124,7 @@ func TestVaultClient_NamespaceSupport(t *testing.T) {
conf.VaultConfig.Namespace = testNs
c, err := vaultclient.NewVaultClient(conf.VaultConfig, logger, nil)
must.NoError(t, err)
must.Eq(t, testNs, c.Vault.Headers().Get(vaultconsts.NamespaceHeaderName))
must.Eq(t, testNs, c.Vault.Headers().Get(vaultNamespaceHeaderName))
}

func TestVaultClient_Heap(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,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/klauspost/cpuid/v2 v2.2.5
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,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=
Expand Down
12 changes: 6 additions & 6 deletions nomad/vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down