mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
fix testcase in pkg/client/leaderelection that wasn't testing what it said it was testing
This commit is contained in:
parent
8535f13a2b
commit
5e03250577
@ -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) {
|
|||||||
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) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
observedRecord: LeaderElectionRecord{HolderIdentity: "bing"},
|
||||||
|
observedTime: past,
|
||||||
|
|
||||||
expectSuccess: true,
|
expectSuccess: true,
|
||||||
outHolder: "baz",
|
outHolder: "baz",
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user