diff --git a/pkg/controlplane/controller/leaderelection/election_test.go b/pkg/controlplane/controller/leaderelection/election_test.go index c6b08d2c7f7..f055ea4a9fa 100644 --- a/pkg/controlplane/controller/leaderelection/election_test.go +++ b/pkg/controlplane/controller/leaderelection/election_test.go @@ -404,6 +404,22 @@ func TestCompare(t *testing.T) { }, expectedResult: 1, }, + { + name: "lhs less than rhs, lexographical order check", + lhs: &v1alpha2.LeaseCandidate{ + Spec: v1alpha2.LeaseCandidateSpec{ + EmulationVersion: "1.2.0", + BinaryVersion: "1.20.0", + }, + }, + rhs: &v1alpha2.LeaseCandidate{ + Spec: v1alpha2.LeaseCandidateSpec{ + EmulationVersion: "1.19.0", + BinaryVersion: "1.20.0", + }, + }, + expectedResult: -1, + }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { diff --git a/test/integration/apiserver/coordinated_leader_election_test.go b/test/integration/apiserver/coordinated_leader_election_test.go index 38bd357e10d..0cd1b487936 100644 --- a/test/integration/apiserver/coordinated_leader_election_test.go +++ b/test/integration/apiserver/coordinated_leader_election_test.go @@ -151,8 +151,7 @@ func TestMultipleLeaseCandidate(t *testing.T) { go cletest.createAndRunFakeController("baz1", "default", "baz", "1.20.0", "1.20.0", tc.preferredStrategy) go cletest.createAndRunFakeController("baz2", "default", "baz", "1.20.0", "1.19.0", tc.preferredStrategy) go cletest.createAndRunFakeController("baz3", "default", "baz", "1.19.0", "1.19.0", tc.preferredStrategy) - go cletest.createAndRunFakeController("baz4", "default", "baz", "1.2.0", "1.19.0", tc.preferredStrategy) - go cletest.createAndRunFakeController("baz5", "default", "baz", "1.20.0", "1.19.0", tc.preferredStrategy) + go cletest.createAndRunFakeController("baz4", "default", "baz", "1.20.0", "1.19.0", tc.preferredStrategy) cletest.pollForLease(ctx, "baz", "default", tc.expectedHolderIdentity) }) }