Skip to content

Commit

Permalink
add a revoke leadership test
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Feb 20, 2018
1 parent f1877e3 commit cb6a697
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions nomad/leader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestLeader_LeftServer(t *testing.T) {
Expand Down Expand Up @@ -978,3 +979,19 @@ func TestLeader_RollRaftServer(t *testing.T) {
})
}
}

func TestLeader_RevokeLeadership_MultipleTimes(t *testing.T) {
s1 := testServer(t, nil)
defer s1.Shutdown()
testutil.WaitForLeader(t, s1.RPC)

testutil.WaitForResult(func() (bool, error) {
return s1.evalBroker.Enabled(), nil
}, func(err error) {
t.Fatalf("should have finished establish leader loop")
})

require.Nil(t, s1.revokeLeadership())
require.Nil(t, s1.revokeLeadership())
require.Nil(t, s1.revokeLeadership())
}

0 comments on commit cb6a697

Please sign in to comment.