diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index e6ce7c80..4abeaced 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -464,7 +464,7 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "d10e393578ca" + "Rev": "fcac651617f2" }, { "ImportPath": "k8s.io/apimachinery", diff --git a/go.mod b/go.mod index da39aec7..b99d7779 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( golang.org/x/net v0.0.0-20201110031124-69a78807bb2b golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e - k8s.io/api v0.0.0-20201209045732-d10e393578ca + k8s.io/api v0.0.0-20201209045733-fcac651617f2 k8s.io/apimachinery v0.0.0-20201209005534-8f01ffc4dcb8 k8s.io/klog/v2 v2.4.0 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 @@ -34,6 +34,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20201209045732-d10e393578ca + k8s.io/api => k8s.io/api v0.0.0-20201209045733-fcac651617f2 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20201209005534-8f01ffc4dcb8 ) diff --git a/go.sum b/go.sum index f9dff855..bafd0c91 100644 --- a/go.sum +++ b/go.sum @@ -433,7 +433,7 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.0.0-20201209045732-d10e393578ca/go.mod h1:xjrWEKNUnu5XTPx3c+1VDDkb3vXmUiTwwHureX1M32c= +k8s.io/api v0.0.0-20201209045733-fcac651617f2/go.mod h1:xjrWEKNUnu5XTPx3c+1VDDkb3vXmUiTwwHureX1M32c= k8s.io/apimachinery v0.0.0-20201209005534-8f01ffc4dcb8/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= diff --git a/tools/cache/delta_fifo.go b/tools/cache/delta_fifo.go index 148b478d..bfa36311 100644 --- a/tools/cache/delta_fifo.go +++ b/tools/cache/delta_fifo.go @@ -572,7 +572,7 @@ func (f *DeltaFIFO) Replace(list []interface{}, resourceVersion string) error { f.populated = true // While there shouldn't be any queued deletions in the initial // population of the queue, it's better to be on the safe side. - f.initialPopulationCount = len(list) + queuedDeletions + f.initialPopulationCount = keys.Len() + queuedDeletions } return nil @@ -602,7 +602,7 @@ func (f *DeltaFIFO) Replace(list []interface{}, resourceVersion string) error { if !f.populated { f.populated = true - f.initialPopulationCount = len(list) + queuedDeletions + f.initialPopulationCount = keys.Len() + queuedDeletions } return nil diff --git a/tools/cache/delta_fifo_test.go b/tools/cache/delta_fifo_test.go index 31cbe880..9e12341d 100644 --- a/tools/cache/delta_fifo_test.go +++ b/tools/cache/delta_fifo_test.go @@ -633,6 +633,15 @@ func TestDeltaFIFO_HasSynced(t *testing.T) { }, expectedSynced: true, }, + { + // This test case won't happen in practice since a Reflector, the only producer for delta_fifo today, always passes a complete snapshot consistent in time; + // there cannot be duplicate keys in the list or apiserver is broken. + actions: []func(f *DeltaFIFO){ + func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("a", 2)}, "0") }, + func(f *DeltaFIFO) { Pop(f) }, + }, + expectedSynced: true, + }, } for i, test := range tests {