test: port test changes to oss (#8694)

This commit is contained in:
Calvin Leung Huang
2020-04-07 11:26:51 -07:00
committed by GitHub
parent 867218c119
commit ba1871d48e
2 changed files with 12 additions and 1 deletions

View File

@@ -390,6 +390,7 @@ func TestPredict_Plugins(t *testing.T) {
"redshift-database-plugin", "redshift-database-plugin",
"ssh", "ssh",
"totp", "totp",
"transform",
"transit", "transit",
"userpass", "userpass",
}, },
@@ -415,6 +416,14 @@ func TestPredict_Plugins(t *testing.T) {
} }
} }
} }
if !strutil.StrListContains(act, "transform") {
for i, v := range tc.exp {
if v == "transform" {
tc.exp = append(tc.exp[:i], tc.exp[i+1:]...)
break
}
}
}
if !reflect.DeepEqual(act, tc.exp) { if !reflect.DeepEqual(act, tc.exp) {
t.Errorf("expected:%q, got: %q", tc.exp, act) t.Errorf("expected:%q, got: %q", tc.exp, act)
} }

View File

@@ -11,6 +11,8 @@ import (
) )
var ( var (
// logicalBackendAdjustmentFactor is set to 1 for the database backend
// which is a plugin but not found in go.mod files
logicalBackendAdjustmentFactor = 1 logicalBackendAdjustmentFactor = 1
) )
@@ -216,7 +218,7 @@ func TestSecretsEnableCommand_Run(t *testing.T) {
// backends are found by walking the directory, which includes the database backend, // backends are found by walking the directory, which includes the database backend,
// however, the plugins registry omits that one // however, the plugins registry omits that one
if len(backends) != len(builtinplugins.Registry.Keys(consts.PluginTypeSecrets))+logicalBackendAdjustmentFactor { if len(backends) != len(builtinplugins.Registry.Keys(consts.PluginTypeSecrets))+logicalBackendAdjustmentFactor {
t.Fatalf("expected %d logical backends, got %d", len(builtinplugins.Registry.Keys(consts.PluginTypeSecrets))+1, len(backends)) t.Fatalf("expected %d logical backends, got %d", len(builtinplugins.Registry.Keys(consts.PluginTypeSecrets))+logicalBackendAdjustmentFactor, len(backends))
} }
for _, b := range backends { for _, b := range backends {