mirror of https://github.com/hashicorp/consul
Fix the Synthetic Policy Tests (#6715)
parent
d554f77d0d
commit
5d687ce6a9
|
@ -143,38 +143,16 @@ func TestStructs_ACLToken_EmbeddedPolicy(t *testing.T) {
|
||||||
func TestStructs_ACLServiceIdentity_SyntheticPolicy(t *testing.T) {
|
func TestStructs_ACLServiceIdentity_SyntheticPolicy(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for _, test := range []struct {
|
cases := []struct {
|
||||||
serviceName string
|
serviceName string
|
||||||
datacenters []string
|
datacenters []string
|
||||||
expectRules string
|
expectRules string
|
||||||
}{
|
}{
|
||||||
{"web", nil, `
|
{"web", nil, aclServiceIdentityRules("web", nil)},
|
||||||
service "web" {
|
{"companion-cube-99", []string{"dc1", "dc2"}, aclServiceIdentityRules("companion-cube-99", nil)},
|
||||||
policy = "write"
|
}
|
||||||
}
|
|
||||||
service "web-sidecar-proxy" {
|
for _, test := range cases {
|
||||||
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"
|
|
||||||
}`},
|
|
||||||
} {
|
|
||||||
name := test.serviceName
|
name := test.serviceName
|
||||||
if len(test.datacenters) > 0 {
|
if len(test.datacenters) > 0 {
|
||||||
name += " [" + strings.Join(test.datacenters, ", ") + "]"
|
name += " [" + strings.Join(test.datacenters, ", ") + "]"
|
||||||
|
|
Loading…
Reference in New Issue