Merge pull request #55568 from m1093782566/unsortlist

Automatic merge from submit-queue (batch tested with PRs 53580, 55568). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Replace sets.List() with sets.UnsortedList() in pkg/proxy

**What this PR does / why we need it**:

Replace sets.List() with sets.UnsortedList() in pkg/proxy - sets.List() will sort the result array, we don't need sorted array in pkg/proxy. Using sets.UnsortedList() can reduce the unnecessary overhead spending.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

@wojtek-t wdyt ^_^

**Release note**:

```release-note
NONE
```

/sig network
This commit is contained in:
Kubernetes Submit Queue
2017-11-12 21:07:37 -08:00
committed by GitHub
5 changed files with 10 additions and 10 deletions

View File

@@ -1067,7 +1067,7 @@ func TestBuildServiceMapAddRemove(t *testing.T) {
// the not-deleted service, because one of it's ServicePorts was deleted.
expectedStaleUDPServices := []string{"172.16.55.10", "172.16.55.4", "172.16.55.11", "172.16.55.12"}
if len(result.staleServices) != len(expectedStaleUDPServices) {
t.Errorf("expected stale UDP services length %d, got %v", len(expectedStaleUDPServices), result.staleServices.List())
t.Errorf("expected stale UDP services length %d, got %v", len(expectedStaleUDPServices), result.staleServices.UnsortedList())
}
for _, ip := range expectedStaleUDPServices {
if !result.staleServices.Has(ip) {
@@ -1183,7 +1183,7 @@ func TestBuildServiceMapServiceUpdate(t *testing.T) {
t.Errorf("expected healthcheck ports length 1, got %v", result.hcServices)
}
if len(result.staleServices) != 0 {
t.Errorf("expected stale UDP services length 0, got %v", result.staleServices.List())
t.Errorf("expected stale UDP services length 0, got %v", result.staleServices.UnsortedList())
}
// No change; make sure the service map stays the same and there are
@@ -1197,7 +1197,7 @@ func TestBuildServiceMapServiceUpdate(t *testing.T) {
t.Errorf("expected healthcheck ports length 1, got %v", result.hcServices)
}
if len(result.staleServices) != 0 {
t.Errorf("expected stale UDP services length 0, got %v", result.staleServices.List())
t.Errorf("expected stale UDP services length 0, got %v", result.staleServices.UnsortedList())
}
// And back to ClusterIP