From d97305e376d1ef5106633b5c452d05b72143d319 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Wed, 7 Jan 2015 15:17:32 -0800 Subject: [PATCH] command: check LastIndex is not zero while waiting for leader --- command/exec_test.go | 5 +---- consul/structs/.structs.go.swp | Bin 0 -> 16384 bytes 2 files changed, 1 insertion(+), 4 deletions(-) create mode 100644 consul/structs/.structs.go.swp diff --git a/command/exec_test.go b/command/exec_test.go index 0e259e5364..4377756a0c 100644 --- a/command/exec_test.go +++ b/command/exec_test.go @@ -79,10 +79,7 @@ func waitForLeader(t *testing.T, httpAddr string) { } testutil.WaitForResult(func() (bool, error) { _, qm, err := client.Catalog().Nodes(nil) - if err != nil { - return false, err - } - return qm.KnownLeader, nil + return err == nil && qm.KnownLeader && qm.LastIndex > 0, err }, func(err error) { t.Fatalf("failed to find leader: %v", err) }) diff --git a/consul/structs/.structs.go.swp b/consul/structs/.structs.go.swp new file mode 100644 index 0000000000000000000000000000000000000000..ed95aabf2a72a0306312931dede3034ae6750cc9 GIT binary patch literal 16384 zcmeI2ZHOIL8ONt;jBAZnt)TSFas80pkj|!wrZyO8*e&jo>>86zTZl!@oqO)R!_Ldi zyzJd;ZE8^zrHERKANoP120<+SB8sFXq6JZ?ShRle1+=zW5NxsdL9F%noH=t}cGE@$ zL1ZrZRq$%RBwIDnJZOj@*4#j1sVk!1sVk!1sVk! z1sVk!1^$l|DEhm+ySblNxqJGe`@U-1_e<{cC6|8xw)}s%{0lC9ziXgw=S7$Qd6)mh zw)|JS^tZY1mg`Vm-z7I+jRK7VjRK7VjRK7VjRK7VjRK7VjRK7VjRK7V|A7L!?Rjsc z-bdtloAdwr`Tw~$dETGl8Td8)0)7II!#Cg_xEs#H7A(WH@EaQY75ow&gCD>}xDP%G z5!?>Ta1ai_0_=t7_jumV;Su->d;)rK99Cc%ZiegND)8X(H+bF!_&D4HAA>Ep8Fs<% zulBs(!EfO~_zWcQVOWOuz#%vY&%NIBo`m}$fHSZTZ-&3k&=x!e55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