refact(action): Make ActionSet behave as a set instead of a list
This switches the implementation of an ActionSet from a slice to a map to ensure the elements in an ActionSet are unique. This allows for other packages to perform set operations such as a union or difference without needing to account for duplicates.
This commit is contained in:
52 files changed
+1401
-274
No files matched your search
@@ -9,6 +9,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"github.com/hashicorp/boundary/api"
|
||||
"github.com/hashicorp/boundary/api/hostcatalogs"
|
||||
"github.com/hashicorp/boundary/api/hosts"
|
||||
@@ -125,7 +127,17 @@ func TestPluginHosts(t *testing.T) {
|
||||
|
||||
h, err := hClient.Read(tc.Context(), hl.Items[0].Id)
|
||||
require.NoError(err)
|
||||
assert.Equal(hl.Items[0], h.Item)
|
||||
assert.Empty(
|
||||
cmp.Diff(
|
||||
hl.Items[0],
|
||||
h.Item,
|
||||
cmpopts.IgnoreUnexported(hosts.Host{}),
|
||||
cmpopts.IgnoreFields(hosts.Host{}, "Version", "UpdatedTime"),
|
||||
cmpopts.SortSlices(func(a, b string) bool {
|
||||
return a < b
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
_, err = hClient.Update(tc.Context(), h.Item.Id, h.Item.Version, hosts.WithName("foo"))
|
||||
require.Error(err)
|
||||
|
||||
Reference in new issue
Block a user