2016-05-30 18:30:01 +00:00
|
|
|
package approle
|
|
|
|
|
|
|
|
import (
|
2018-01-19 06:44:44 +00:00
|
|
|
"context"
|
2016-05-30 18:30:01 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/vault/logical"
|
|
|
|
)
|
|
|
|
|
|
|
|
func createBackendWithStorage(t *testing.T) (*backend, logical.Storage) {
|
|
|
|
config := logical.TestBackendConfig()
|
|
|
|
config.StorageView = &logical.InmemStorage{}
|
|
|
|
|
|
|
|
b, err := Backend(config)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if b == nil {
|
|
|
|
t.Fatalf("failed to create backend")
|
|
|
|
}
|
2018-01-19 06:44:44 +00:00
|
|
|
err = b.Backend.Setup(context.Background(), config)
|
2016-05-30 18:30:01 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
return b, config.StorageView
|
|
|
|
}
|