plugins: Handle mount/enable for shadowed builtins (#17879)

* Allow mounting external plugins with same name/type as deprecated builtins
* Add some go tests for deprecation status handling
* Move timestamp storage to post-unseal
* Add upgrade-aware deprecation shutdown and tests
This commit is contained in:
Mike Palmiotto
2022-12-14 13:06:33 -05:00
committed by GitHub
parent 83c007700e
commit 82f998f071
13 changed files with 341 additions and 98 deletions

View File

@@ -250,13 +250,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
@@ -264,6 +257,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())
}