Files
threshold/internal/plugin/host/testing.go
T
Johan Brandhorst-Satzkorn 7f9b294a7e refact(all): Use testing.TB for test helpers
Our test helper packages were not possible to use
with benchmarks. This refactor switches to testing.TB
to allow both tests and benchmarks to use the helpers.
2022-04-29 16:33:44 -04:00

22 lines
398 B
Go

package host
import (
"context"
"testing"
"github.com/hashicorp/boundary/internal/db"
"github.com/stretchr/testify/require"
)
func TestPlugin(t testing.TB, conn *db.DB, name string) *Plugin {
t.Helper()
p := NewPlugin(WithName(name))
id, err := newPluginId()
require.NoError(t, err)
p.PublicId = id
w := db.New(conn)
require.NoError(t, w.Create(context.Background(), p))
return p
}