diff --git a/agent/structs/acl_legacy.go b/agent/structs/acl_legacy.go index 3d5c23b36..2572c203e 100644 --- a/agent/structs/acl_legacy.go +++ b/agent/structs/acl_legacy.go @@ -106,21 +106,6 @@ func (tok *ACLToken) Convert() (*ACL, error) { return compat, nil } -// IsSame checks if one ACL is the same as another, without looking -// at the Raft information (that's why we didn't call it IsEqual). This is -// useful for seeing if an update would be idempotent for all the functional -// parts of the structure. -func (a *ACL) IsSame(other *ACL) bool { - if a.ID != other.ID || - a.Name != other.Name || - a.Type != other.Type || - a.Rules != other.Rules { - return false - } - - return true -} - // ACLRequest is used to create, update or delete an ACL type ACLRequest struct { Datacenter string diff --git a/agent/structs/acl_legacy_test.go b/agent/structs/acl_legacy_test.go index a17b7c753..18cd479ec 100644 --- a/agent/structs/acl_legacy_test.go +++ b/agent/structs/acl_legacy_test.go @@ -6,53 +6,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestStructs_ACL_IsSame(t *testing.T) { - acl := &ACL{ - ID: "guid", - Name: "An ACL for testing", - Type: "client", - Rules: "service \"\" { policy = \"read\" }", - } - if !acl.IsSame(acl) { - t.Fatalf("should be equal to itself") - } - - other := &ACL{ - ID: "guid", - Name: "An ACL for testing", - Type: "client", - Rules: "service \"\" { policy = \"read\" }", - RaftIndex: RaftIndex{ - CreateIndex: 1, - ModifyIndex: 2, - }, - } - if !acl.IsSame(other) || !other.IsSame(acl) { - t.Fatalf("should not care about Raft fields") - } - - check := func(twiddle, restore func()) { - if !acl.IsSame(other) || !other.IsSame(acl) { - t.Fatalf("should be the same") - } - - twiddle() - if acl.IsSame(other) || other.IsSame(acl) { - t.Fatalf("should not be the same") - } - - restore() - if !acl.IsSame(other) || !other.IsSame(acl) { - t.Fatalf("should be the same") - } - } - - check(func() { other.ID = "nope" }, func() { other.ID = "guid" }) - check(func() { other.Name = "nope" }, func() { other.Name = "An ACL for testing" }) - check(func() { other.Type = "management" }, func() { other.Type = "client" }) - check(func() { other.Rules = "" }, func() { other.Rules = "service \"\" { policy = \"read\" }" }) -} - func TestStructs_ACL_Convert(t *testing.T) { acl := &ACL{