Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/raft/rafttest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ go_test(
deps = [
"//pkg/raft",
"//pkg/raft/raftpb",
"//pkg/testutils/skip",
],
)
15 changes: 5 additions & 10 deletions pkg/raft/rafttest/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"github.com/cockroachdb/cockroach/pkg/raft"
pb "github.com/cockroachdb/cockroach/pkg/raft/raftpb"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
)

func TestBasicProgress(t *testing.T) {
Expand Down Expand Up @@ -54,9 +53,6 @@ func TestBasicProgress(t *testing.T) {
}

func TestRestart(t *testing.T) {
// TODO(pav-kv): de-flake it. See https://github.com/etcd-io/raft/issues/181.
skip.UnderStress(t, "the test is flaky")

peers := []raft.Peer{{ID: 1, Context: nil}, {ID: 2, Context: nil}, {ID: 3, Context: nil}, {ID: 4, Context: nil}, {ID: 5, Context: nil}}
nt := newRaftNetwork(1, 2, 3, 4, 5)

Expand Down Expand Up @@ -136,23 +132,22 @@ func TestPause(t *testing.T) {
}

func waitLeader(ns []*node) int {
var l map[pb.PeerID]struct{}
var lindex int

l := make(map[pb.PeerID]struct{})
for {
l = make(map[pb.PeerID]struct{})
clear(l)
lindex := -1

for i, n := range ns {
lead := n.Status().HardState.Lead
if lead != 0 {
if lead != raft.None {
l[lead] = struct{}{}
if n.id == lead {
lindex = i
}
}
}

if len(l) == 1 {
if len(l) == 1 && lindex != -1 {
return lindex
}
}
Expand Down