diff --git a/e2e/ctl_v3_auth_test.go b/e2e/ctl_v3_auth_test.go index 1028cfd63..d9f0123e7 100644 --- a/e2e/ctl_v3_auth_test.go +++ b/e2e/ctl_v3_auth_test.go @@ -40,6 +40,9 @@ func TestCtlV3AuthInvalidMgmt(t *testing.T) { testCtl(t, authTestInvalidMgm func TestCtlV3AuthFromKeyPerm(t *testing.T) { testCtl(t, authTestFromKeyPerm) } func TestCtlV3AuthAndWatch(t *testing.T) { testCtl(t, authTestWatch) } +func TestCtlV3AuthRoleGet(t *testing.T) { testCtl(t, authTestRoleGet) } +func TestCtlV3AuthRoleList(t *testing.T) { testCtl(t, authTestRoleList) } + func authEnableTest(cx ctlCtx) { if err := authEnable(cx); err != nil { cx.t.Fatal(err) @@ -739,3 +742,31 @@ func authTestWatch(cx ctlCtx) { } } + +func authTestRoleGet(cx ctlCtx) { + if err := authEnable(cx); err != nil { + cx.t.Fatal(err) + } + cx.user, cx.pass = "root", "root" + authSetupTestUser(cx) + + expected := []string{ + "Role test-role", + "KV Read:", "foo", + "KV Write:", "foo", + } + if err := spawnWithExpects(append(cx.PrefixArgs(), "role", "get", "test-role"), expected...); err != nil { + cx.t.Fatal(err) + } +} + +func authTestRoleList(cx ctlCtx) { + if err := authEnable(cx); err != nil { + cx.t.Fatal(err) + } + cx.user, cx.pass = "root", "root" + authSetupTestUser(cx) + if err := spawnWithExpect(append(cx.PrefixArgs(), "role", "list"), "test-role"); err != nil { + cx.t.Fatal(err) + } +}