Add create, list, lookup functions for plugin based host catalogs (#1515)

Create the repository for plugin host catalogs.  A large TODO is left in the code to interface with the plugin system once ready.
This commit is contained in:
Todd Knight authored and GitHub committed 2021-09-09 11:15:14 -07:00
1 parent 1249f9668f
commit 4f09f1d74f
15 files changed
+665 -50

No files matched your search

+4 -4
View File
@@ -14,12 +14,12 @@ import (
// TestCatalog creates count number of plugin host catalogs to the provided DB
// with the provided scope id. If any errors are encountered during the creation of
// the host catalog, the test will fail.
func TestCatalog(t *testing.T, conn *gorm.DB, pluginId, scopeId string, opt ...Option) *HostCatalog {
func TestCatalog(t *testing.T, conn *gorm.DB, scopeId, pluginId string, opt ...Option) *HostCatalog {
t.Helper()
ctx := context.Background()
w := db.New(conn)
cat, err := NewHostCatalog(ctx, pluginId, scopeId, opt...)
cat, err := NewHostCatalog(ctx, scopeId, pluginId, opt...)
require.NoError(t, err)
assert.NotNil(t, cat)
@@ -27,7 +27,7 @@ func TestCatalog(t *testing.T, conn *gorm.DB, pluginId, scopeId string, opt ...O
plg.PublicId = pluginId
require.NoError(t, w.LookupByPublicId(ctx, plg))
id, err := newHostCatalogId(plg.GetIdPrefix())
id, err := newHostCatalogId(ctx, plg.GetIdPrefix())
assert.NoError(t, err)
assert.NotEmpty(t, id)
cat.PublicId = id
@@ -57,7 +57,7 @@ func TestSet(t *testing.T, conn *gorm.DB, catalogId string, opt ...Option) *Host
plg.PublicId = cg.GetPluginId()
require.NoError(t, w.LookupByPublicId(ctx, plg))
id, err := newHostSetId(plg.GetIdPrefix())
id, err := newHostSetId(ctx, plg.GetIdPrefix())
assert.NoError(err)
assert.NotEmpty(id)
set.PublicId = id