Add unit tests for RepackSubsets to take pod UID into consideration

This commit is contained in:
Dr. Stefan Schimanski
2015-06-29 12:13:40 +02:00
parent 55daf3b80e
commit 79e54c2679
2 changed files with 98 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ func RepackSubsets(subsets []api.EndpointSubset) []api.EndpointSubset {
// First map each unique port definition to the sets of hosts that
// offer it. The sets of hosts must be de-duped, using IP+UID as the key.
type addressKey struct {
ip string
ip string
uid types.UID
}
allAddrs := map[addressKey]*api.EndpointAddress{}
@@ -120,10 +120,10 @@ func LessEndpointAddress(a, b *api.EndpointAddress) bool {
if ipComparison != 0 {
return ipComparison < 0
}
if (b.TargetRef == nil) {
if b.TargetRef == nil {
return false
}
if (a.TargetRef == nil) {
if a.TargetRef == nil {
return true
}
return a.TargetRef.UID < b.TargetRef.UID