backport of commit 82f998f071 (#18373)

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
This commit is contained in:
hc-github-team-secure-vault-core
2022-12-14 11:47:16 -08:00
committed by GitHub
parent d4fa7208f6
commit f99420c92c
13 changed files with 341 additions and 99 deletions

View File

@@ -2,7 +2,6 @@ package command
import (
"io/ioutil"
"os"
"strings"
"testing"
@@ -245,13 +244,6 @@ func TestSecretsEnableCommand_Run(t *testing.T) {
for _, b := range backends {
expectedResult := 0
status, _ := builtinplugins.Registry.DeprecationStatus(b, consts.PluginTypeSecrets)
allowDeprecated := os.Getenv(consts.VaultAllowPendingRemovalMountsEnv)
// Need to handle deprecated builtins specially
if (status == consts.PendingRemoval && allowDeprecated == "") || status == consts.Removed {
expectedResult = 2
}
ui, cmd := testSecretsEnableCommand(t)
cmd.client = client
@@ -259,6 +251,13 @@ func TestSecretsEnableCommand_Run(t *testing.T) {
actualResult := cmd.Run([]string{
b,
})
// Need to handle deprecated builtins specially
status, _ := builtinplugins.Registry.DeprecationStatus(b, consts.PluginTypeSecrets)
if status == consts.PendingRemoval || status == consts.Removed {
expectedResult = 2
}
if actualResult != expectedResult {
t.Errorf("type: %s - got: %d, expected: %d - %s", b, actualResult, expectedResult, ui.OutputWriter.String()+ui.ErrorWriter.String())
}