Remove Prefix Id and Plugin Name fields (#1563)
* Remove Prefix Id and Plugin Name fields. Creating catalogs now require either the plugin id or the name of the plugin resource (but not both). Host Catalogs and Host Sets API resources now have a read only plugin field populated with plugin info. Host Catalogs have a plugin id field as a top level field.
This commit is contained in:
51 files changed
+1314
-1052
No files matched your search
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
// PublicId prefixes for the resources in the plugin package.
|
||||
const (
|
||||
PluginPrefix = "plgh"
|
||||
PluginPrefix = "pl"
|
||||
)
|
||||
|
||||
func newPluginId() (string, error) {
|
||||
|
||||
@@ -19,7 +19,7 @@ func TestHostPlugin_ImmutableFields(t *testing.T) {
|
||||
w := db.New(conn)
|
||||
|
||||
ts := timestamp.Timestamp{Timestamp: ×tamppb.Timestamp{Seconds: 0, Nanos: 0}}
|
||||
plg := TestPlugin(t, conn, "test", "prefix")
|
||||
plg := TestPlugin(t, conn, "test")
|
||||
|
||||
newPlugin := plg
|
||||
|
||||
@@ -46,15 +46,6 @@ func TestHostPlugin_ImmutableFields(t *testing.T) {
|
||||
}(),
|
||||
fieldMask: []string{"CreateTime"},
|
||||
},
|
||||
{
|
||||
name: "pluginName",
|
||||
update: func() *Plugin {
|
||||
c := newPlugin.testClonePlugin()
|
||||
c.PluginName = "different pluginName"
|
||||
return c
|
||||
}(),
|
||||
fieldMask: []string{"PluginName"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
@@ -16,12 +16,10 @@ type Plugin struct {
|
||||
|
||||
// NewPlugin creates a new in memory Plugin assigned to the global scope.
|
||||
// Name, Description are the only allowed option. All other options are ignored.
|
||||
func NewPlugin(pluginName, idPrefix string, opt ...Option) *Plugin {
|
||||
func NewPlugin(opt ...Option) *Plugin {
|
||||
opts := getOpts(opt...)
|
||||
p := &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: pluginName,
|
||||
IdPrefix: idPrefix,
|
||||
ScopeId: scope.Global.String(),
|
||||
Name: opts.withName,
|
||||
Description: opts.withDescription,
|
||||
|
||||
@@ -15,168 +15,50 @@ import (
|
||||
func TestPlugin_Create(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
|
||||
type args struct {
|
||||
pluginName string
|
||||
idPrefix string
|
||||
opts []Option
|
||||
}
|
||||
type args struct{}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
opts []Option
|
||||
want *Plugin
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "blank-pluginName",
|
||||
args: args{
|
||||
idPrefix: "prefix",
|
||||
},
|
||||
name: "valid",
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
IdPrefix: "prefix",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "blank-idPrefix",
|
||||
args: args{
|
||||
pluginName: "plugin name",
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "plugin name",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "idprefix-capitalized",
|
||||
args: args{
|
||||
pluginName: "idprefixcapitalized",
|
||||
idPrefix: "IdPrefixCapitalized",
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "idprefixcapitalized",
|
||||
IdPrefix: "IdPrefixCapitalized",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "idprefix-space",
|
||||
args: args{
|
||||
pluginName: "idprefix space",
|
||||
idPrefix: "idprefix space",
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "idprefix space",
|
||||
IdPrefix: "idprefix space",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "pluginName-capitalized",
|
||||
args: args{
|
||||
pluginName: "PluginNameCapitalized",
|
||||
idPrefix: "pluginnamecapitalized",
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "PluginNameCapitalized",
|
||||
IdPrefix: "pluginnamecapitalized",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "valid-no-options",
|
||||
args: args{
|
||||
pluginName: "validnooptions",
|
||||
idPrefix: "validnooptions",
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "validnooptions",
|
||||
IdPrefix: "validnooptions",
|
||||
ScopeId: scope.Global.String(),
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "valid-with-description",
|
||||
args: args{
|
||||
pluginName: "validwithdescription",
|
||||
idPrefix: "validwithdescription",
|
||||
opts: []Option{
|
||||
WithDescription("description"),
|
||||
},
|
||||
},
|
||||
name: "with-name",
|
||||
opts: []Option{WithName("foo")},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "validwithdescription",
|
||||
IdPrefix: "validwithdescription",
|
||||
Name: "foo",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "with-description",
|
||||
opts: []Option{WithDescription("foo")},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
Description: "foo",
|
||||
ScopeId: scope.Global.String(),
|
||||
Description: "description",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "valid-pluginName-name-option",
|
||||
args: args{
|
||||
pluginName: "validpluginnamenameoption",
|
||||
idPrefix: "validpluginnamenameoption",
|
||||
opts: []Option{
|
||||
WithName("valid-pluginName-name-option"),
|
||||
WithDescription("description"),
|
||||
},
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "validpluginnamenameoption",
|
||||
IdPrefix: "validpluginnamenameoption",
|
||||
ScopeId: scope.Global.String(),
|
||||
Name: "valid-pluginName-name-option",
|
||||
Description: "description",
|
||||
},
|
||||
},
|
||||
},
|
||||
// This must be run after the "valid-no-options" test
|
||||
{
|
||||
name: "duplicate-pluginName",
|
||||
args: args{
|
||||
pluginName: "validnooptions",
|
||||
idPrefix: "duplicatepluginname",
|
||||
},
|
||||
name: "duplicate-name",
|
||||
opts: []Option{WithName("foo")},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "validnooptions",
|
||||
IdPrefix: "duplicatepluginname",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "duplicate-idPrefix",
|
||||
args: args{
|
||||
pluginName: "duplicateidprefix",
|
||||
idPrefix: "validnooptions",
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
PluginName: "duplicateidprefix",
|
||||
IdPrefix: "validnooptions",
|
||||
ScopeId: scope.Global.String(),
|
||||
Name: "foo",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
@@ -186,7 +68,7 @@ func TestPlugin_Create(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := NewPlugin(tt.args.pluginName, tt.args.idPrefix, tt.args.opts...)
|
||||
got := NewPlugin(tt.opts...)
|
||||
require.NotNil(t, got)
|
||||
require.Emptyf(t, got.PublicId, "PublicId set")
|
||||
|
||||
@@ -212,7 +94,7 @@ func TestPlugin_Update(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
w := db.New(conn)
|
||||
ctx := context.Background()
|
||||
plg := TestPlugin(t, conn, "delete-plugin", "prefix")
|
||||
plg := TestPlugin(t, conn, "delete-plugin")
|
||||
assert.Equal(t, uint32(1), plg.Version)
|
||||
|
||||
plg.Name = "New"
|
||||
@@ -230,7 +112,7 @@ func TestPlugin_Delete(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
w := db.New(conn)
|
||||
ctx := context.Background()
|
||||
plg := TestPlugin(t, conn, "delete-plugin", "prefix")
|
||||
plg := TestPlugin(t, conn, "delete-plugin")
|
||||
|
||||
deleted, err := w.Delete(ctx, plg)
|
||||
require.NoError(t, err)
|
||||
@@ -261,7 +143,7 @@ func TestPlugin_SetTableName(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
def := NewPlugin("", "prefix")
|
||||
def := NewPlugin()
|
||||
require.Equal(defaultTableName, def.TableName())
|
||||
s := &Plugin{
|
||||
Plugin: &store.Plugin{},
|
||||
|
||||
@@ -16,9 +16,6 @@ import (
|
||||
// contain a valid ScopeID. p must not contain a PublicId. The PublicId is
|
||||
// generated and assigned by this method. opt is ignored.
|
||||
//
|
||||
// Both p.IdPrefix and p.PluginName are required and must match. The
|
||||
// p.IdPrefix must contain only lower case alphanumeric characters.
|
||||
//
|
||||
// Both p.Name and p.Description are optional. If p.Name is set, it must be
|
||||
// unique within p.ScopeID.
|
||||
//
|
||||
@@ -40,17 +37,6 @@ func (r *Repository) CreatePlugin(ctx context.Context, p *Plugin, _ ...Option) (
|
||||
if p.PublicId != "" {
|
||||
return nil, errors.New(ctx, errors.InvalidParameter, op, "public id not empty")
|
||||
}
|
||||
if p.PluginName == "" {
|
||||
return nil, errors.New(ctx, errors.InvalidParameter, op, "no plugin name")
|
||||
}
|
||||
if p.IdPrefix == "" {
|
||||
return nil, errors.New(ctx, errors.InvalidParameter, op, "no id prefix")
|
||||
}
|
||||
// TODO: remove the restriction on prefix having to be the same as plugin name
|
||||
if p.PluginName != p.IdPrefix {
|
||||
return nil, errors.New(ctx, errors.InvalidParameter, op, "id prefix and plugin name don't match")
|
||||
}
|
||||
|
||||
p = p.clone()
|
||||
|
||||
id, err := newPluginId()
|
||||
@@ -112,16 +98,16 @@ func (r *Repository) LookupPlugin(ctx context.Context, id string, _ ...Option) (
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// LookupPluginByPluginName returns the Plugin for a given name. Returns nil, nil if no
|
||||
// LookupPluginByName returns the Plugin for a given name. Returns nil, nil if no
|
||||
// Plugin is found with that plugin name.
|
||||
func (r *Repository) LookupPluginByPluginName(ctx context.Context, name string, _ ...Option) (*Plugin, error) {
|
||||
const op = "host.(Repository).LookupPluginByPluginName"
|
||||
func (r *Repository) LookupPluginByName(ctx context.Context, name string, _ ...Option) (*Plugin, error) {
|
||||
const op = "host.(Repository).LookupPluginByName"
|
||||
if name == "" {
|
||||
return nil, errors.New(ctx, errors.InvalidParameter, op, "no plugin name")
|
||||
}
|
||||
p := allocPlugin()
|
||||
|
||||
if err := r.reader.LookupWhere(ctx, p, "plugin_name=?", name); err != nil {
|
||||
if err := r.reader.LookupWhere(ctx, p, "name=?", name); err != nil {
|
||||
if errors.IsNotFoundError(err) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -41,39 +41,18 @@ func TestRepository_CreatePlugin(t *testing.T) {
|
||||
in: &Plugin{},
|
||||
wantIsErr: errors.InvalidParameter,
|
||||
},
|
||||
{
|
||||
name: "valid-no-options",
|
||||
in: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "validnooptions",
|
||||
PluginName: "validnooptions",
|
||||
},
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "validnooptions",
|
||||
PluginName: "validnooptions",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "valid-with-name",
|
||||
in: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
Name: "test-name-repo",
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "validwithname",
|
||||
PluginName: "validwithname",
|
||||
Name: "test-name-repo",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
Name: "test-name-repo",
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "validwithname",
|
||||
PluginName: "validwithname",
|
||||
Name: "test-name-repo",
|
||||
ScopeId: scope.Global.String(),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -83,37 +62,20 @@ func TestRepository_CreatePlugin(t *testing.T) {
|
||||
Plugin: &store.Plugin{
|
||||
Description: "test-description-repo",
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "validwithdescription",
|
||||
PluginName: "validwithdescription",
|
||||
},
|
||||
},
|
||||
want: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
Description: "test-description-repo",
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "validwithdescription",
|
||||
PluginName: "validwithdescription",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "mismatching-prefix-plugin-name",
|
||||
in: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "foo",
|
||||
PluginName: "bar",
|
||||
},
|
||||
},
|
||||
wantIsErr: errors.InvalidParameter,
|
||||
},
|
||||
{
|
||||
name: "non-global-scope",
|
||||
in: &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
ScopeId: "o_1234567890",
|
||||
IdPrefix: "foo",
|
||||
PluginName: "foo",
|
||||
ScopeId: "o_1234567890",
|
||||
},
|
||||
},
|
||||
wantIsErr: errors.InvalidParameter,
|
||||
@@ -150,38 +112,8 @@ func TestRepository_CreatePlugin(t *testing.T) {
|
||||
assert.NotNil(repo)
|
||||
in := &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "invalidduplicatenames",
|
||||
PluginName: "invalidduplicatenames",
|
||||
Name: "invalid-duplicate-names",
|
||||
},
|
||||
}
|
||||
|
||||
got, err := repo.CreatePlugin(context.Background(), in)
|
||||
assert.NoError(err)
|
||||
assert.NotNil(got)
|
||||
assertPublicId(t, PluginPrefix, got.PublicId)
|
||||
assert.NotSame(in, got)
|
||||
assert.Equal(in.Name, got.Name)
|
||||
assert.Equal(in.Description, got.Description)
|
||||
assert.Equal(got.CreateTime, got.UpdateTime)
|
||||
|
||||
got2, err := repo.CreatePlugin(context.Background(), in)
|
||||
assert.Truef(errors.Match(errors.T(errors.NotUnique), err), "want err code: %v got err: %v", errors.NotUnique, err)
|
||||
assert.Nil(got2)
|
||||
})
|
||||
|
||||
t.Run("invalid-duplicate-plugin-names-prefixes", func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
kms := kms.TestKms(t, conn, wrapper)
|
||||
repo, err := NewRepository(rw, rw, kms)
|
||||
assert.NoError(err)
|
||||
assert.NotNil(repo)
|
||||
in := &Plugin{
|
||||
Plugin: &store.Plugin{
|
||||
ScopeId: scope.Global.String(),
|
||||
IdPrefix: "invalidduplicatepluginnames",
|
||||
PluginName: "invalidduplicatepluginnames",
|
||||
ScopeId: scope.Global.String(),
|
||||
Name: "invalid-duplicate-names",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -212,7 +144,7 @@ func TestRepository_LookupPlugin(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
rw := db.New(conn)
|
||||
wrapper := db.TestWrapper(t)
|
||||
plg := TestPlugin(t, conn, "test", "test")
|
||||
plg := TestPlugin(t, conn, "test")
|
||||
badId, err := newPluginId()
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, badId)
|
||||
@@ -268,11 +200,11 @@ func TestRepository_LookupPlugin(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepository_LookupPluginByPluginName(t *testing.T) {
|
||||
func TestRepository_LookupPluginByName(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
rw := db.New(conn)
|
||||
wrapper := db.TestWrapper(t)
|
||||
plg := TestPlugin(t, conn, "name123", "name123")
|
||||
plg := TestPlugin(t, conn, "name123")
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -282,7 +214,7 @@ func TestRepository_LookupPluginByPluginName(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "found",
|
||||
pluginName: plg.GetPluginName(),
|
||||
pluginName: plg.GetName(),
|
||||
want: plg,
|
||||
},
|
||||
{
|
||||
@@ -307,7 +239,7 @@ func TestRepository_LookupPluginByPluginName(t *testing.T) {
|
||||
assert.NoError(err)
|
||||
assert.NotNil(repo)
|
||||
|
||||
got, err := repo.LookupPluginByPluginName(context.Background(), tt.pluginName)
|
||||
got, err := repo.LookupPluginByName(context.Background(), tt.pluginName)
|
||||
if tt.wantErr != 0 {
|
||||
assert.Truef(errors.Match(errors.T(tt.wantErr), err), "want err: %q got: %q", tt.wantErr, err)
|
||||
return
|
||||
|
||||
@@ -49,12 +49,6 @@ type Plugin struct {
|
||||
ScopeId string `protobuf:"bytes,60,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty" gorm:"not_null"`
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
Version uint32 `protobuf:"varint,70,opt,name=version,proto3" json:"version,omitempty" gorm:"default:null"`
|
||||
// plugin_name is required. The value must be unique across all host plugins
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
PluginName string `protobuf:"bytes,80,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty" gorm:"default:null"`
|
||||
// id_prefix is required. The value must be unique across all host plugins
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
IdPrefix string `protobuf:"bytes,90,opt,name=id_prefix,json=idPrefix,proto3" json:"id_prefix,omitempty" gorm:"default:null"`
|
||||
}
|
||||
|
||||
func (x *Plugin) Reset() {
|
||||
@@ -138,20 +132,6 @@ func (x *Plugin) GetVersion() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Plugin) GetPluginName() string {
|
||||
if x != nil {
|
||||
return x.PluginName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Plugin) GetIdPrefix() string {
|
||||
if x != nil {
|
||||
return x.IdPrefix
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_controller_storage_plugin_host_store_v1_plugin_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_controller_storage_plugin_host_store_v1_plugin_proto_rawDesc = []byte{
|
||||
@@ -166,7 +146,7 @@ var file_controller_storage_plugin_host_store_v1_plugin_proto_rawDesc = []byte{
|
||||
0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73,
|
||||
0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f,
|
||||
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x03, 0x0a,
|
||||
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdc, 0x02, 0x0a,
|
||||
0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c,
|
||||
0x69, 0x63, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74,
|
||||
@@ -188,16 +168,12 @@ var file_controller_storage_plugin_host_store_v1_plugin_proto_rawDesc = []byte{
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x49,
|
||||
0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x46, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x70,
|
||||
0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0a, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09,
|
||||
0x69, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x69, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x42, 0x40, 0x5a, 0x3e, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
|
||||
0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2f,
|
||||
0x73, 0x74, 0x6f, 0x72, 0x65, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x40, 0x5a, 0x3e, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63,
|
||||
0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x68, 0x6f, 0x73,
|
||||
0x74, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPlugin(t *testing.T, conn *gorm.DB, name string, prefix string) *Plugin {
|
||||
func TestPlugin(t *testing.T, conn *gorm.DB, name string) *Plugin {
|
||||
t.Helper()
|
||||
p := NewPlugin(name, prefix)
|
||||
p := NewPlugin(WithName(name))
|
||||
id, err := newPluginId()
|
||||
require.NoError(t, err)
|
||||
p.PublicId = id
|
||||
|
||||
@@ -12,7 +12,7 @@ func Test_TestPlugins(t *testing.T) {
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
|
||||
plg := TestPlugin(t, conn, "test", "prefix")
|
||||
plg := TestPlugin(t, conn, "test")
|
||||
require.NotNil(plg)
|
||||
assert.NotEmpty(plg.GetPublicId())
|
||||
}
|
||||
Reference in new issue
Block a user