raft: return active config in Status

This is useful for debug purposes, and more so once we support joint
quorums.
This commit is contained in:
Tobias Schottdorf
2019-07-17 14:29:45 +02:00
parent 26a1e60eab
commit 7ce934cbec
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import (
"reflect"
"testing"
"go.etcd.io/etcd/raft/quorum"
"go.etcd.io/etcd/raft/raftpb"
"go.etcd.io/etcd/raft/tracker"
)
@ -460,6 +461,13 @@ func TestRawNodeStatus(t *testing.T) {
if exp, act := *rn.raft.prs.Progress[1], status.Progress[1]; !reflect.DeepEqual(exp, act) {
t.Fatalf("want: %+v\ngot: %+v", exp, act)
}
expCfg := tracker.Config{Voters: quorum.JointConfig{
quorum.MajorityConfig{1: {}},
nil,
}}
if !reflect.DeepEqual(expCfg, status.Config) {
t.Fatalf("want: %+v\ngot: %+v", expCfg, status.Config)
}
}
// TestRawNodeCommitPaginationAfterRestart is the RawNode version of