Multiple grant scope IDs (#4251)
Co-authored-by: Timothy Messier <tim.messier@gmail.com> Co-authored-by: Todd <github@quaddi.com>
This commit is contained in:
70 files changed
+5460
-1009
No files matched your search
@@ -147,18 +147,23 @@ func TestCrud(t *testing.T) {
|
||||
hcClient := hostcatalogs.NewClient(client)
|
||||
|
||||
hc, err := hcClient.Create(tc.Context(), "static", proj.GetPublicId(), hostcatalogs.WithName("foo"))
|
||||
require.NoError(err)
|
||||
checkCatalog("create", hc.Item, err, "foo", 1)
|
||||
|
||||
hc, err = hcClient.Read(tc.Context(), hc.Item.Id)
|
||||
require.NoError(err)
|
||||
checkCatalog("read", hc.Item, err, "foo", 1)
|
||||
|
||||
hc, err = hcClient.Update(tc.Context(), hc.Item.Id, hc.Item.Version, hostcatalogs.WithName("foo"))
|
||||
require.NoError(err)
|
||||
checkCatalog("update", hc.Item, err, "foo", 1)
|
||||
|
||||
hc, err = hcClient.Update(tc.Context(), hc.Item.Id, hc.Item.Version, hostcatalogs.WithName("bar"))
|
||||
require.NoError(err)
|
||||
checkCatalog("update", hc.Item, err, "bar", 2)
|
||||
|
||||
hc, err = hcClient.Update(tc.Context(), hc.Item.Id, hc.Item.Version, hostcatalogs.DefaultName())
|
||||
require.NoError(err)
|
||||
checkCatalog("update", hc.Item, err, "", 3)
|
||||
|
||||
_, err = hcClient.Delete(tc.Context(), hc.Item.Id)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/boundary/globals"
|
||||
"github.com/hashicorp/boundary/sdk/pbs/controller/api"
|
||||
pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/roles"
|
||||
"github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes"
|
||||
@@ -53,6 +54,10 @@ func TestRoles(t *testing.T) {
|
||||
UpdatedTime: pbNow,
|
||||
Version: 0,
|
||||
GrantScopeId: &wrapperspb.StringValue{Value: "grant-scope-id"},
|
||||
GrantScopeIds: []string{
|
||||
globals.GrantScopeThis,
|
||||
"grant-scope-id",
|
||||
},
|
||||
PrincipalIds: []string{
|
||||
"principal-id",
|
||||
},
|
||||
@@ -99,6 +104,10 @@ func TestRoles(t *testing.T) {
|
||||
UpdatedTime: pbNow,
|
||||
Version: 0,
|
||||
GrantScopeId: &wrapperspb.StringValue{Value: "grant-scope-id"},
|
||||
GrantScopeIds: []string{
|
||||
globals.GrantScopeThis,
|
||||
"grant-scope-id",
|
||||
},
|
||||
PrincipalIds: []string{
|
||||
"principal-id",
|
||||
},
|
||||
|
||||
@@ -69,7 +69,7 @@ func TestCustom(t *testing.T) {
|
||||
require.NotNil(g)
|
||||
|
||||
rc := roles.NewClient(client)
|
||||
var version uint32 = 1
|
||||
var version uint32 = 2
|
||||
|
||||
r, err := rc.Create(tc.Context(), tt.scopeId, roles.WithName("foo"))
|
||||
require.NoError(err)
|
||||
@@ -241,16 +241,16 @@ func TestCrud(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
roleClient := roles.NewClient(client)
|
||||
g, err := roleClient.Create(tc.Context(), tt.scopeId, roles.WithName("foo"))
|
||||
checkRole("create", g.Item, err, "foo", 1)
|
||||
checkRole("create", g.Item, err, "foo", 2)
|
||||
|
||||
g, err = roleClient.Read(tc.Context(), g.Item.Id)
|
||||
checkRole("read", g.Item, err, "foo", 1)
|
||||
checkRole("read", g.Item, err, "foo", 2)
|
||||
|
||||
g, err = roleClient.Update(tc.Context(), g.Item.Id, g.Item.Version, roles.WithName("bar"))
|
||||
checkRole("update", g.Item, err, "bar", 2)
|
||||
checkRole("update", g.Item, err, "bar", 3)
|
||||
|
||||
g, err = roleClient.Update(tc.Context(), g.Item.Id, g.Item.Version, roles.DefaultName())
|
||||
checkRole("update", g.Item, err, "", 3)
|
||||
checkRole("update", g.Item, err, "", 4)
|
||||
|
||||
_, err = roleClient.Delete(tc.Context(), g.Item.Id)
|
||||
require.NoError(err)
|
||||
|
||||
Reference in new issue
Block a user