From 5d687ce6a98ba911d08eb49caa19328d2cf7ddbb Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Wed, 30 Oct 2019 15:15:14 -0400 Subject: [PATCH] Fix the Synthetic Policy Tests (#6715) --- agent/structs/acl_test.go | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/agent/structs/acl_test.go b/agent/structs/acl_test.go index 546e2113e6..87fff974e1 100644 --- a/agent/structs/acl_test.go +++ b/agent/structs/acl_test.go @@ -143,38 +143,16 @@ func TestStructs_ACLToken_EmbeddedPolicy(t *testing.T) { func TestStructs_ACLServiceIdentity_SyntheticPolicy(t *testing.T) { t.Parallel() - for _, test := range []struct { + cases := []struct { serviceName string datacenters []string expectRules string }{ - {"web", nil, ` -service "web" { - policy = "write" -} -service "web-sidecar-proxy" { - policy = "write" -} -service_prefix "" { - policy = "read" -} -node_prefix "" { - policy = "read" -}`}, - {"companion-cube-99", []string{"dc1", "dc2"}, ` -service "companion-cube-99" { - policy = "write" -} -service "companion-cube-99-sidecar-proxy" { - policy = "write" -} -service_prefix "" { - policy = "read" -} -node_prefix "" { - policy = "read" -}`}, - } { + {"web", nil, aclServiceIdentityRules("web", nil)}, + {"companion-cube-99", []string{"dc1", "dc2"}, aclServiceIdentityRules("companion-cube-99", nil)}, + } + + for _, test := range cases { name := test.serviceName if len(test.datacenters) > 0 { name += " [" + strings.Join(test.datacenters, ", ") + "]"