Fixed a harmless bug where initialPopulationCount should be based on the key length not list size in DeltaFIFO#Replace()

Kubernetes-commit: bc39672c0638426979feef95baeff39d170161eb
This commit is contained in:
Qing Ju
2020-11-22 16:35:19 -08:00
committed by Kubernetes Publisher
parent 50c086135a
commit 1d175299a2
2 changed files with 11 additions and 2 deletions

View File

@@ -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 {