Skip to content

Commit

Permalink
Check the term before failure
Browse files Browse the repository at this point in the history
  • Loading branch information
adibrastegarnia committed Sep 14, 2020
1 parent bb6ea72 commit f26ef35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/ha/session_failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *TestSuite) TestSessionFailOver(t *testing.T) {
found := gnmi.WaitForDevice(t, func(d *device.Device) bool {
currentTerm, _ = strconv.Atoi(d.Attributes[mastershipTermKey])
masterNode = d.Attributes[mastershipMasterKey]
return len(d.Protocols) > 0 &&
return currentTerm == 1 && len(d.Protocols) > 0 &&
d.Protocols[0].Protocol == device.Protocol_GNMI &&
d.Protocols[0].ConnectivityState == device.ConnectivityState_REACHABLE &&
d.Protocols[0].ChannelState == device.ChannelState_CONNECTED &&
Expand All @@ -52,7 +52,7 @@ func (s *TestSuite) TestSessionFailOver(t *testing.T) {
// Crash master pod
hautils.CrashPodOrFail(t, masterPod)

// Waits for a new master to be selected, establish a connection to the device
// Waits for a new master to be elected (i.e. the term will be increased), it establishes a connection to the device
// and updates the device state
found = gnmi.WaitForDevice(t, func(d *device.Device) bool {
currentTerm, _ = strconv.Atoi(d.Attributes[mastershipTermKey])
Expand Down

0 comments on commit f26ef35

Please sign in to comment.