Skip to content

Commit

Permalink
tests: check Cluster node flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Nov 21, 2015
1 parent 98414ea commit d3c6b6f
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,22 @@ func startCluster(scenario *clusterScenario) error {
// Wait until all nodes have consistent info
for _, client := range scenario.clients {
err := eventually(func() error {
for _, masterId := range scenario.nodeIds[:3] {
s := client.ClusterNodes().Val()
wanted := "slave " + masterId
if !strings.Contains(s, wanted) {
return fmt.Errorf("%q does not contain %q", s, wanted)
s := client.ClusterNodes().Val()
nodes := strings.Split(s, "\n")
if len(nodes) < 6 {
return fmt.Errorf("got %d nodes, wanted 6", len(nodes))
}
for _, node := range nodes {
if node == "" {
continue
}
parts := strings.Split(node, " ")
var flags string
if len(parts) >= 3 {
flags = parts[2]
}
if !strings.Contains(flags, "master") && !strings.Contains(flags, "slave") {
return fmt.Errorf("node flags are %q", flags)
}
}
return nil
Expand Down

0 comments on commit d3c6b6f

Please sign in to comment.