Skip to content

Commit

Permalink
enable WIF for test sysview
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Apr 22, 2024
1 parent 6ac5468 commit da4eecd
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/hashicorp/go-hclog"
log "github.com/hashicorp/go-hclog"
"github.com/hashicorp/vault/sdk/helper/logging"
"github.com/hashicorp/vault/sdk/helper/pluginutil"
"github.com/hashicorp/vault/sdk/logical"
)

Expand All @@ -26,15 +27,23 @@ var (
testClientSecret = "testClientSecret"
)

type testSystemViewEnt struct {
logical.StaticSystemView
}

func (d testSystemViewEnt) GenerateIdentityToken(_ context.Context, _ *pluginutil.IdentityTokenRequest) (*pluginutil.IdentityTokenResponse, error) {
return &pluginutil.IdentityTokenResponse{}, nil
}

func getTestBackendMocked(t *testing.T, initConfig bool) (*azureSecretBackend, logical.Storage) {
b := backend()
sysView := testSystemViewEnt{}
sysView.DefaultLeaseTTLVal = defaultLeaseTTLHr
sysView.MaxLeaseTTLVal = maxLeaseTTLHr

config := &logical.BackendConfig{
Logger: logging.NewVaultLogger(log.Trace),
System: &logical.StaticSystemView{
DefaultLeaseTTLVal: defaultLeaseTTLHr,
MaxLeaseTTLVal: maxLeaseTTLHr,
},
Logger: logging.NewVaultLogger(log.Trace),
System: &sysView,
StorageView: &logical.InmemStorage{},
}
err := b.Setup(context.Background(), config)
Expand Down

0 comments on commit da4eecd

Please sign in to comment.