Unit test that calls revokeLeadership twice to make sure its idempotent

This commit is contained in:
Preetha Appan 2018-02-21 12:48:53 -06:00
parent bd270b02ba
commit 573500dc51
No known key found for this signature in database
GPG Key ID: 9F7C19990A50EAFC
1 changed files with 19 additions and 0 deletions

View File

@ -761,3 +761,22 @@ func TestServer_TLSToFullVerify(t *testing.T) {
t.Fatalf("bad: %v", success)
}
}
func TestServer_RevokeLeadershipIdempotent(t *testing.T) {
t.Parallel()
dir1, s1 := testServer(t)
defer os.RemoveAll(dir1)
defer s1.Shutdown()
testrpc.WaitForLeader(t, s1.RPC, "dc1")
err:= s1.revokeLeadership()
if err != nil {
t.Fatal(err)
}
err = s1.revokeLeadership()
if err != nil {
t.Fatal(err)
}
}