command: make TestExecCommandRun_CrossDC more resilient

Wait after WAN join that both members see each other.
This commit is contained in:
Frank Schroeder 2017-07-01 00:59:48 +02:00 committed by Frank Schröder
parent 7381a05d8d
commit 406dc2ead8
1 changed files with 10 additions and 4 deletions

View File

@ -62,13 +62,19 @@ func TestExecCommandRun_CrossDC(t *testing.T) {
// Join over the WAN
wanAddr := fmt.Sprintf("%s:%d", a1.Config.BindAddr, a1.Config.Ports.SerfWan)
n, err := a2.JoinWAN([]string{wanAddr})
_, err := a2.JoinWAN([]string{wanAddr})
if err != nil {
t.Fatalf("err: %v", err)
}
if n != 1 {
t.Fatalf("bad %d", n)
}
retry.Run(t, func(r *retry.R) {
if got, want := len(a1.WANMembers()), 2; got != want {
r.Fatalf("got %d WAN members on a1 want %d", got, want)
}
if got, want := len(a2.WANMembers()), 2; got != want {
r.Fatalf("got %d WAN members on a2 want %d", got, want)
}
})
ui, c := testExecCommand(t)
args := []string{"-http-addr=" + a1.HTTPAddr(), "-wait=500ms", "-datacenter=dc2", "uptime"}