etcdserver: update member attribute when apply request
This commit is contained in:
@ -22,6 +22,7 @@ import (
|
||||
"math/rand"
|
||||
"path"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@ -384,6 +385,25 @@ func TestApplyRequest(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyRequestOnAdminMemberAttributes(t *testing.T) {
|
||||
cl := newTestCluster([]Member{{ID: 1}})
|
||||
srv := &EtcdServer{
|
||||
store: &storeRecorder{},
|
||||
Cluster: cl,
|
||||
}
|
||||
req := pb.Request{
|
||||
Method: "PUT",
|
||||
ID: 1,
|
||||
Path: path.Join(storeMembersPrefix, strconv.FormatUint(1, 16), attributesSuffix),
|
||||
Val: `{"Name":"abc","ClientURLs":["http://127.0.0.1:4001"]}`,
|
||||
}
|
||||
srv.applyRequest(req)
|
||||
w := Attributes{Name: "abc", ClientURLs: []string{"http://127.0.0.1:4001"}}
|
||||
if g := cl.Member(1).Attributes; !reflect.DeepEqual(g, w) {
|
||||
t.Errorf("attributes = %v, want %v", g, w)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: test ErrIDRemoved
|
||||
func TestApplyConfChangeError(t *testing.T) {
|
||||
nodes := []uint64{1, 2, 3}
|
||||
|
Reference in New Issue
Block a user