mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Adds adjustment factor for assertions in auth enable tests (#22679)
* Adds adjustment factor for assertions in auth enable tests * format comment
This commit is contained in:
@@ -14,6 +14,12 @@ import (
|
|||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// credentialBackendAdjustmentFactor allows for adjusting test assertions for
|
||||||
|
// credential backends. Add 1 to account for the "token" backend, which is visible
|
||||||
|
// when you walk the filesystem but is treated as special and excluded from the registry.
|
||||||
|
// Subtract 1 to account for "oidc" which is an alias of "jwt" and not a separate plugin.
|
||||||
|
var credentialBackendAdjustmentFactor = 1 - 1
|
||||||
|
|
||||||
func testAuthEnableCommand(tb testing.TB) (*cli.MockUi, *AuthEnableCommand) {
|
func testAuthEnableCommand(tb testing.TB) (*cli.MockUi, *AuthEnableCommand) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
|
|
||||||
@@ -205,10 +211,7 @@ func TestAuthEnableCommand_Run(t *testing.T) {
|
|||||||
// of credential backends.
|
// of credential backends.
|
||||||
backends = append(backends, "pcf")
|
backends = append(backends, "pcf")
|
||||||
|
|
||||||
// Add 1 to account for the "token" backend, which is visible when you walk the filesystem but
|
expected := len(builtinplugins.Registry.Keys(consts.PluginTypeCredential)) + credentialBackendAdjustmentFactor
|
||||||
// is treated as special and excluded from the registry.
|
|
||||||
// Subtract 1 to account for "oidc" which is an alias of "jwt" and not a separate plugin.
|
|
||||||
expected := len(builtinplugins.Registry.Keys(consts.PluginTypeCredential))
|
|
||||||
if len(backends) != expected {
|
if len(backends) != expected {
|
||||||
t.Fatalf("expected %d credential backends, got %d", expected, len(backends))
|
t.Fatalf("expected %d credential backends, got %d", expected, len(backends))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user