etcdserver: do not allow creating empty role

Like user, we should not allow creating empty role.

Related #10905
This commit is contained in:
Sahdev P. Zala
2019-07-18 23:36:46 -04:00
parent d137fa9d4a
commit 1cef112a79
10 changed files with 33 additions and 10 deletions

View File

@@ -40,4 +40,9 @@ func TestRoleError(t *testing.T) {
if err != rpctypes.ErrRoleAlreadyExist {
t.Fatalf("expected %v, got %v", rpctypes.ErrRoleAlreadyExist, err)
}
_, err = authapi.RoleAdd(context.TODO(), "")
if err != rpctypes.ErrRoleEmpty {
t.Fatalf("expected %v, got %v", rpctypes.ErrRoleEmpty, err)
}
}