Skip to content

Commit

Permalink
Test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalmi committed Nov 17, 2022
1 parent 39fab8c commit a92ff97
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions command/auth_enable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package command

import (
"io/ioutil"
"os"
"strings"
"testing"

Expand Down Expand Up @@ -227,8 +226,6 @@ func TestAuthEnableCommand_Run(t *testing.T) {
for _, b := range backends {
var expectedResult int = 0

status, _ := builtinplugins.Registry.DeprecationStatus(b, consts.PluginTypeCredential)

// Not a builtin
if b == "token" {
continue
Expand All @@ -242,6 +239,7 @@ func TestAuthEnableCommand_Run(t *testing.T) {
})

// Need to handle deprecated builtins specially
status, _ := builtinplugins.Registry.DeprecationStatus(b, consts.PluginTypeCredential)
if (status == consts.PendingRemoval && !vault.PendingRemovalMountsAllowed) || status == consts.Removed {
expectedResult = 2
}
Expand Down
3 changes: 2 additions & 1 deletion command/path_map_upgrade_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ func TestPathMap_Upgrade_API(t *testing.T) {
client := cores[0].Client

// Enable the app-id method
prevAllowed := vault.PendingRemovalMountsAllowed
vault.PendingRemovalMountsAllowed = true
err = client.Sys().EnableAuthWithOptions("app-id", &api.EnableAuthOptions{
Type: "app-id",
})
if err != nil {
t.Fatal(err)
}
vault.PendingRemovalMountsAllowed = false
vault.PendingRemovalMountsAllowed = prevAllowed

// Create an app-id
_, err = client.Logical().Write("auth/app-id/map/app-id/test-app-id", map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion command/secrets_enable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ func TestSecretsEnableCommand_Run(t *testing.T) {

for _, b := range backends {
expectedResult := 0
status, _ := builtinplugins.Registry.DeprecationStatus(b, consts.PluginTypeSecrets)

ui, cmd := testSecretsEnableCommand(t)
cmd.client = client
Expand All @@ -261,6 +260,7 @@ func TestSecretsEnableCommand_Run(t *testing.T) {
})

// Need to handle deprecated builtins specially
status, _ := builtinplugins.Registry.DeprecationStatus(b, consts.PluginTypeSecrets)
if (status == consts.PendingRemoval && !vault.PendingRemovalMountsAllowed) || status == consts.Removed {
expectedResult = 2
}
Expand Down

0 comments on commit a92ff97

Please sign in to comment.