mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
sever/auth: fix addUserWithNoOption of store_test
Signed-off-by: engow <engow@hotmail.com>
This commit is contained in:
parent
dcb1bf6078
commit
f7ac9dfcd6
@ -126,7 +126,10 @@ func setupAuthStore(t *testing.T) (store *authStore, teardownfunc func(t *testin
|
|||||||
|
|
||||||
// The UserAdd function cannot generate old etcd version user data (user's option is nil)
|
// The UserAdd function cannot generate old etcd version user data (user's option is nil)
|
||||||
// add special users through the underlying interface
|
// add special users through the underlying interface
|
||||||
addUserWithNoOption(as)
|
err = addUserWithNoOption(as)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
tearDown := func(_ *testing.T) {
|
tearDown := func(_ *testing.T) {
|
||||||
b.Close()
|
b.Close()
|
||||||
@ -135,16 +138,12 @@ func setupAuthStore(t *testing.T) (store *authStore, teardownfunc func(t *testin
|
|||||||
return as, tearDown
|
return as, tearDown
|
||||||
}
|
}
|
||||||
|
|
||||||
func addUserWithNoOption(as *authStore) {
|
func addUserWithNoOption(as *authStore) error {
|
||||||
tx := as.be.BatchTx()
|
_, err := as.UserAdd(&pb.AuthUserAddRequest{Name: "foo-no-user-options", Password: "bar"})
|
||||||
tx.Lock()
|
if err != nil {
|
||||||
defer tx.Unlock()
|
return err
|
||||||
tx.UnsafePutUser(&authpb.User{
|
}
|
||||||
Name: []byte("foo-no-user-options"),
|
return nil
|
||||||
Password: []byte("bar"),
|
|
||||||
})
|
|
||||||
as.commitRevision(tx)
|
|
||||||
as.refreshRangePermCache(tx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func enableAuthAndCreateRoot(as *authStore) error {
|
func enableAuthAndCreateRoot(as *authStore) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user