Add couchbase, elasticsearch, and mongodbatlas back (#10222)

Updated the `Serve` function so these can be added back into Vault
This commit is contained in:
Michael Golowka
2020-10-22 17:20:17 -06:00
committed by GitHub
parent d87657199d
commit 233a19e8f8
256 changed files with 48577 additions and 66 deletions

View File

@@ -10,9 +10,8 @@ import (
"testing"
"time"
// mongodbatlas "github.com/hashicorp/vault-plugin-database-mongodbatlas"
"github.com/go-test/deep"
mongodbatlas "github.com/hashicorp/vault-plugin-database-mongodbatlas"
"github.com/hashicorp/vault/helper/namespace"
postgreshelper "github.com/hashicorp/vault/helper/testhelpers/postgresql"
vaulthttp "github.com/hashicorp/vault/http"
@@ -49,7 +48,7 @@ func getCluster(t *testing.T) (*vault.TestCluster, logical.SystemView) {
sys := vault.TestDynamicSystemView(cores[0].Core)
vault.TestAddTestPlugin(t, cores[0].Core, "postgresql-database-plugin", consts.PluginTypeDatabase, "TestBackend_PluginMain_Postgres", []string{}, "")
vault.TestAddTestPlugin(t, cores[0].Core, "mongodb-database-plugin", consts.PluginTypeDatabase, "TestBackend_PluginMain_Mongo", []string{}, "")
// vault.TestAddTestPlugin(t, cores[0].Core, "mongodbatlas-database-plugin", consts.PluginTypeDatabase, "TestBackend_PluginMain_MongoAtlas", []string{}, "")
vault.TestAddTestPlugin(t, cores[0].Core, "mongodbatlas-database-plugin", consts.PluginTypeDatabase, "TestBackend_PluginMain_MongoAtlas", []string{}, "")
return cluster, sys
}
@@ -80,27 +79,18 @@ func TestBackend_PluginMain_Mongo(t *testing.T) {
v5.Serve(dbType.(v5.Database))
}
// func TestBackend_PluginMain_MongoAtlas(t *testing.T) {
// if os.Getenv(pluginutil.PluginUnwrapTokenEnv) == "" {
// return
// }
//
// caPEM := os.Getenv(pluginutil.PluginCACertPEMEnv)
// if caPEM == "" {
// t.Fatal("CA cert not passed in")
// }
//
// args := []string{"--ca-cert=" + caPEM}
//
// apiClientMeta := &api.PluginAPIClientMeta{}
// flags := apiClientMeta.FlagSet()
// flags.Parse(args)
//
// err := mongodbatlas.Run(apiClientMeta.GetTLSConfig())
// if err != nil {
// t.Fatal(err)
// }
// }
func TestBackend_PluginMain_MongoAtlas(t *testing.T) {
if os.Getenv(pluginutil.PluginUnwrapTokenEnv) == "" {
return
}
dbType, err := mongodbatlas.New()
if err != nil {
t.Fatalf("Failed to initialize mongodbatlas: %s", err)
}
v5.Serve(dbType.(v5.Database))
}
func TestBackend_RoleUpgrade(t *testing.T) {