Commit 5e032505 authored by Mike Danese's avatar Mike Danese

fix testcase in pkg/client/leaderelection that wasn't testing what it said it was testing

parent 8535f13a
...@@ -35,6 +35,7 @@ import ( ...@@ -35,6 +35,7 @@ import (
func TestTryAcquireOrRenew(t *testing.T) { func TestTryAcquireOrRenew(t *testing.T) {
future := time.Now().Add(1000 * time.Hour) future := time.Now().Add(1000 * time.Hour)
past := time.Now().Add(-1000 * time.Hour)
tests := []struct { tests := []struct {
observedRecord LeaderElectionRecord observedRecord LeaderElectionRecord
...@@ -109,6 +110,9 @@ func TestTryAcquireOrRenew(t *testing.T) { ...@@ -109,6 +110,9 @@ func TestTryAcquireOrRenew(t *testing.T) {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Namespace: action.GetNamespace(), Namespace: action.GetNamespace(),
Name: action.(testclient.GetAction).GetName(), Name: action.(testclient.GetAction).GetName(),
Annotations: map[string]string{
LeaderElectionRecordAnnotationKey: `{"holderIdentity":"bing"}`,
},
}, },
}, nil }, nil
}, },
...@@ -120,6 +124,9 @@ func TestTryAcquireOrRenew(t *testing.T) { ...@@ -120,6 +124,9 @@ func TestTryAcquireOrRenew(t *testing.T) {
}, },
}, },
}, },
observedRecord: LeaderElectionRecord{HolderIdentity: "bing"},
observedTime: past,
expectSuccess: true, expectSuccess: true,
outHolder: "baz", outHolder: "baz",
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment