From 406dc2ead8a1d95386e8b86bb4a99ed4058f7c6f Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Sat, 1 Jul 2017 00:59:48 +0200 Subject: [PATCH] command: make TestExecCommandRun_CrossDC more resilient Wait after WAN join that both members see each other. --- command/exec_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/command/exec_test.go b/command/exec_test.go index 0029734d2b..e4d71ac476 100644 --- a/command/exec_test.go +++ b/command/exec_test.go @@ -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"}