From 5e032505770cea660a613edc6a830dfa09388cc6 Mon Sep 17 00:00:00 2001 From: Mike Danese Date: Fri, 11 Dec 2015 10:58:46 -0800 Subject: [PATCH] fix testcase in pkg/client/leaderelection that wasn't testing what it said it was testing --- pkg/client/leaderelection/leaderelection_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/client/leaderelection/leaderelection_test.go b/pkg/client/leaderelection/leaderelection_test.go index 73f43e20082a0..608c56e0084da 100644 --- a/pkg/client/leaderelection/leaderelection_test.go +++ b/pkg/client/leaderelection/leaderelection_test.go @@ -35,6 +35,7 @@ import ( func TestTryAcquireOrRenew(t *testing.T) { future := time.Now().Add(1000 * time.Hour) + past := time.Now().Add(-1000 * time.Hour) tests := []struct { observedRecord LeaderElectionRecord @@ -109,6 +110,9 @@ func TestTryAcquireOrRenew(t *testing.T) { ObjectMeta: api.ObjectMeta{ Namespace: action.GetNamespace(), Name: action.(testclient.GetAction).GetName(), + Annotations: map[string]string{ + LeaderElectionRecordAnnotationKey: `{"holderIdentity":"bing"}`, + }, }, }, nil }, @@ -120,6 +124,9 @@ func TestTryAcquireOrRenew(t *testing.T) { }, }, }, + observedRecord: LeaderElectionRecord{HolderIdentity: "bing"}, + observedTime: past, + expectSuccess: true, outHolder: "baz", },