consul: Check that ACL also allows registration

This commit is contained in:
Armon Dadgar 2014-11-30 21:10:42 -07:00
parent d74f79b3fa
commit 402d580863
1 changed files with 7 additions and 2 deletions

View File

@ -50,7 +50,6 @@ func TestCatalogRegister_ACLDeny(t *testing.T) {
c.ACLDatacenter = "dc1" c.ACLDatacenter = "dc1"
c.ACLMasterToken = "root" c.ACLMasterToken = "root"
c.ACLDefaultPolicy = "deny" c.ACLDefaultPolicy = "deny"
c.ACLToken = "root"
}) })
defer os.RemoveAll(dir1) defer os.RemoveAll(dir1)
defer s1.Shutdown() defer s1.Shutdown()
@ -93,6 +92,12 @@ func TestCatalogRegister_ACLDeny(t *testing.T) {
if err == nil || !strings.Contains(err.Error(), permissionDenied) { if err == nil || !strings.Contains(err.Error(), permissionDenied) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }
argR.Service.Service = "foo"
err = client.Call("Catalog.Register", &argR, &outR)
if err != nil {
t.Fatalf("err: %v", err)
}
} }
func TestCatalogRegister_ForwardLeader(t *testing.T) { func TestCatalogRegister_ForwardLeader(t *testing.T) {
@ -775,6 +780,6 @@ func TestCatalogRegister_FailedCase1(t *testing.T) {
var testRegisterRules = ` var testRegisterRules = `
service "foo" { service "foo" {
policy = "read" policy = "write"
} }
` `