tests/framework: Add User operations

This commit is contained in:
Danielle Lancashire
2022-03-17 15:48:01 +00:00
parent 4787e71921
commit adae7a659e
4 changed files with 118 additions and 0 deletions

View File

@ -259,3 +259,25 @@ func (c integrationClient) LeaseRevoke(id clientv3.LeaseID) (*clientv3.LeaseRevo
return c.Client.Revoke(ctx, id)
}
func (c integrationClient) UserAdd(name, password string, opts config.UserAddOptions) (*clientv3.AuthUserAddResponse, error) {
ctx := context.Background()
return c.Client.UserAddWithOptions(ctx, name, password, &clientv3.UserAddOptions{
NoPassword: opts.NoPassword,
})
}
func (c integrationClient) UserList() (*clientv3.AuthUserListResponse, error) {
ctx := context.Background()
return c.Client.UserList(ctx)
}
func (c integrationClient) UserDelete(name string) (*clientv3.AuthUserDeleteResponse, error) {
ctx := context.Background()
return c.Client.UserDelete(ctx, name)
}
func (c integrationClient) UserChangePass(user, newPass string) error {
_, err := c.Client.UserChangePassword(context.Background(), user, newPass)
return err
}