Skip to content

Commit

Permalink
Fix unit test for control-plane failing due to added policies
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed Oct 13, 2023
1 parent d07c133 commit f535f97
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions control-plane/subcommand/server-acl-init/command_ent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ func TestRun_ACLPolicyUpdates(t *testing.T) {
require.NoError(t, err)

// Check that the expected policies were created.
// There will be more policies returned in the List API that are defaults
// existing in Consul on startup, including but not limited to:
// * global-management
// * builtin/global-read-only
// * agent-token
firstRunExpectedPolicies := []string{
"anonymous-token-policy",
"client-policy",
Expand All @@ -336,12 +341,6 @@ func TestRun_ACLPolicyUpdates(t *testing.T) {
policies, _, err := consul.ACL().PolicyList(nil)
require.NoError(t, err)

// Check that we have the right number of policies. The actual
// policies will have two more than expected because of the
// global management and namespace management polices that
// are automatically created, the latter in consul-ent v1.7+.
require.Equal(t, len(firstRunExpectedPolicies), len(policies)-2)

// Collect the actual policies into a map to make it easier to assert
// on their existence and contents.
actualPolicies := make(map[string]string)
Expand Down Expand Up @@ -388,12 +387,6 @@ func TestRun_ACLPolicyUpdates(t *testing.T) {
policies, _, err = consul.ACL().PolicyList(nil)
require.NoError(t, err)

// Check that we have the right number of policies. The actual
// policies will have two more than expected because of the
// global management and namespace management polices that
// are automatically created, the latter in consul-ent v1.7+.
require.Equal(t, len(secondRunExpectedPolicies), len(policies)-2)

// Collect the actual policies into a map to make it easier to assert
// on their existence and contents.
actualPolicies = make(map[string]string)
Expand Down

0 comments on commit f535f97

Please sign in to comment.