modify tests

Kubernetes-commit: 2cd5dbbdaab98020b37df7125f622db7a6dd885a
This commit is contained in:
Keisuke Ishigami 2025-06-14 22:04:22 +09:00 committed by Kubernetes Publisher
parent d56ed5816f
commit 00429ab356
4 changed files with 52 additions and 49 deletions

View File

@ -17,6 +17,7 @@ limitations under the License.
package cache package cache
import ( import (
"context"
"fmt" "fmt"
"reflect" "reflect"
"runtime" "runtime"
@ -86,12 +87,12 @@ func (f *DeltaFIFO) GetByKey(key string) (item interface{}, exists bool, err err
// helper function to reduce stuttering // helper function to reduce stuttering
func testPop(f *DeltaFIFO) testFifoObject { func testPop(f *DeltaFIFO) testFifoObject {
return Pop(f).(Deltas).Newest().Object.(testFifoObject) return Pop(context.Background(), f).(Deltas).Newest().Object.(testFifoObject)
} }
// testPopIfAvailable returns `{}, false` if Pop returns a nil object // testPopIfAvailable returns `{}, false` if Pop returns a nil object
func testPopIfAvailable(f *DeltaFIFO) (testFifoObject, bool) { func testPopIfAvailable(f *DeltaFIFO) (testFifoObject, bool) {
obj := Pop(f) obj := Pop(context.Background(), f)
if obj == nil { if obj == nil {
return testFifoObject{}, false return testFifoObject{}, false
} }
@ -179,7 +180,7 @@ func TestDeltaFIFO_replaceWithDeleteDeltaIn(t *testing.T) {
f.Delete(oldObj) f.Delete(oldObj)
f.Replace([]interface{}{newObj}, "") f.Replace([]interface{}{newObj}, "")
actualDeltas := Pop(f) actualDeltas := Pop(context.Background(), f)
expectedDeltas := Deltas{ expectedDeltas := Deltas{
Delta{Type: Deleted, Object: oldObj}, Delta{Type: Deleted, Object: oldObj},
Delta{Type: Sync, Object: newObj}, Delta{Type: Sync, Object: newObj},
@ -289,7 +290,7 @@ func TestDeltaFIFOW_ReplaceMakesDeletionsForObjectsOnlyInQueue(t *testing.T) {
}), }),
}) })
tt.operations(fWithKnownObjects) tt.operations(fWithKnownObjects)
actualDeltasWithKnownObjects := Pop(fWithKnownObjects) actualDeltasWithKnownObjects := Pop(context.Background(), fWithKnownObjects)
if !reflect.DeepEqual(tt.expectedDeltas, actualDeltasWithKnownObjects) { if !reflect.DeepEqual(tt.expectedDeltas, actualDeltasWithKnownObjects) {
t.Errorf("expected %#v, got %#v", tt.expectedDeltas, actualDeltasWithKnownObjects) t.Errorf("expected %#v, got %#v", tt.expectedDeltas, actualDeltasWithKnownObjects)
} }
@ -302,7 +303,7 @@ func TestDeltaFIFOW_ReplaceMakesDeletionsForObjectsOnlyInQueue(t *testing.T) {
KeyFunction: testFifoObjectKeyFunc, KeyFunction: testFifoObjectKeyFunc,
}) })
tt.operations(fWithoutKnownObjects) tt.operations(fWithoutKnownObjects)
actualDeltasWithoutKnownObjects := Pop(fWithoutKnownObjects) actualDeltasWithoutKnownObjects := Pop(context.Background(), fWithoutKnownObjects)
if !reflect.DeepEqual(tt.expectedDeltas, actualDeltasWithoutKnownObjects) { if !reflect.DeepEqual(tt.expectedDeltas, actualDeltasWithoutKnownObjects) {
t.Errorf("expected %#v, got %#v", tt.expectedDeltas, actualDeltasWithoutKnownObjects) t.Errorf("expected %#v, got %#v", tt.expectedDeltas, actualDeltasWithoutKnownObjects)
} }
@ -402,7 +403,7 @@ func TestDeltaFIFO_transformer(t *testing.T) {
} }
for i := 0; i < 2; i++ { for i := 0; i < 2; i++ {
obj, err := f.Pop(func(o interface{}, isInInitialList bool) error { return nil }) obj, err := f.Pop(context.Background(), func(o interface{}, isInInitialList bool) error { return nil })
if err != nil { if err != nil {
t.Fatalf("got nothing on try %v?", i) t.Fatalf("got nothing on try %v?", i)
} }
@ -592,7 +593,7 @@ func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -618,7 +619,7 @@ func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -648,7 +649,7 @@ func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -679,7 +680,7 @@ func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -697,7 +698,7 @@ func TestDeltaFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -727,7 +728,7 @@ func TestDeltaFIFO_ReplaceMakesDeletionsReplaced(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -751,7 +752,7 @@ func TestDeltaFIFO_ReplaceDeltaType(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -773,18 +774,18 @@ func TestDeltaFIFO_UpdateResyncRace(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
} }
} }
// pop2 captures both parameters, unlike Pop(). // pop2 captures both parameters, unlike Pop(context.Background(), ).
func pop2[T any](queue Queue) (T, bool) { func pop2[T any](queue Queue) (T, bool) {
var result interface{} var result interface{}
var isList bool var isList bool
queue.Pop(func(obj interface{}, isInInitialList bool) error { queue.Pop(context.Background(), func(obj interface{}, isInInitialList bool) error {
result = obj result = obj
isList = isInInitialList isList = isInInitialList
return nil return nil
@ -909,15 +910,15 @@ func TestDeltaFIFO_HasSynced(t *testing.T) {
{ {
actions: []func(f *DeltaFIFO){ actions: []func(f *DeltaFIFO){
func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
func(f *DeltaFIFO) { Pop(f) }, func(f *DeltaFIFO) { Pop(context.Background(), f) },
}, },
expectedSynced: false, expectedSynced: false,
}, },
{ {
actions: []func(f *DeltaFIFO){ actions: []func(f *DeltaFIFO){
func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
func(f *DeltaFIFO) { Pop(f) }, func(f *DeltaFIFO) { Pop(context.Background(), f) },
func(f *DeltaFIFO) { Pop(f) }, func(f *DeltaFIFO) { Pop(context.Background(), f) },
}, },
expectedSynced: true, expectedSynced: true,
}, },
@ -926,7 +927,7 @@ func TestDeltaFIFO_HasSynced(t *testing.T) {
// there cannot be duplicate keys in the list or apiserver is broken. // there cannot be duplicate keys in the list or apiserver is broken.
actions: []func(f *DeltaFIFO){ actions: []func(f *DeltaFIFO){
func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("a", 2)}, "0") }, func(f *DeltaFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("a", 2)}, "0") },
func(f *DeltaFIFO) { Pop(f) }, func(f *DeltaFIFO) { Pop(context.Background(), f) },
}, },
expectedSynced: true, expectedSynced: true,
}, },
@ -958,7 +959,7 @@ func TestDeltaFIFO_PopShouldUnblockWhenClosed(t *testing.T) {
const jobs = 10 const jobs = 10
for i := 0; i < jobs; i++ { for i := 0; i < jobs; i++ {
go func() { go func() {
f.Pop(func(obj interface{}, isInInitialList bool) error { f.Pop(context.Background(), func(obj interface{}, isInInitialList bool) error {
return nil return nil
}) })
c <- struct{}{} c <- struct{}{}

View File

@ -17,6 +17,7 @@ limitations under the License.
package cache package cache
import ( import (
"context"
"reflect" "reflect"
"runtime" "runtime"
"testing" "testing"
@ -97,7 +98,7 @@ func TestFIFO_basic(t *testing.T) {
lastInt := int(0) lastInt := int(0)
lastUint := uint64(0) lastUint := uint64(0)
for i := 0; i < amount*2; i++ { for i := 0; i < amount*2; i++ {
switch obj := Pop(f).(testFifoObject).val.(type) { switch obj := Pop(context.Background(), f).(testFifoObject).val.(type) {
case int: case int:
if obj <= lastInt { if obj <= lastInt {
t.Errorf("got %v (int) out of order, last was %v", obj, lastInt) t.Errorf("got %v (int) out of order, last was %v", obj, lastInt)
@ -131,7 +132,7 @@ func TestFIFO_addUpdate(t *testing.T) {
got := make(chan testFifoObject, 2) got := make(chan testFifoObject, 2)
go func() { go func() {
for { for {
obj := Pop(f) obj := Pop(context.Background(), f)
if obj == nil { if obj == nil {
return return
} }
@ -162,7 +163,7 @@ func TestFIFO_addReplace(t *testing.T) {
got := make(chan testFifoObject, 2) got := make(chan testFifoObject, 2)
go func() { go func() {
for { for {
obj := Pop(f) obj := Pop(context.Background(), f)
if obj == nil { if obj == nil {
return return
} }
@ -194,21 +195,21 @@ func TestFIFO_detectLineJumpers(t *testing.T) {
f.Add(mkFifoObj("foo", 13)) f.Add(mkFifoObj("foo", 13))
f.Add(mkFifoObj("zab", 30)) f.Add(mkFifoObj("zab", 30))
if e, a := 13, Pop(f).(testFifoObject).val; a != e { if e, a := 13, Pop(context.Background(), f).(testFifoObject).val; a != e {
t.Fatalf("expected %d, got %d", e, a) t.Fatalf("expected %d, got %d", e, a)
} }
f.Add(mkFifoObj("foo", 14)) // ensure foo doesn't jump back in line f.Add(mkFifoObj("foo", 14)) // ensure foo doesn't jump back in line
if e, a := 1, Pop(f).(testFifoObject).val; a != e { if e, a := 1, Pop(context.Background(), f).(testFifoObject).val; a != e {
t.Fatalf("expected %d, got %d", e, a) t.Fatalf("expected %d, got %d", e, a)
} }
if e, a := 30, Pop(f).(testFifoObject).val; a != e { if e, a := 30, Pop(context.Background(), f).(testFifoObject).val; a != e {
t.Fatalf("expected %d, got %d", e, a) t.Fatalf("expected %d, got %d", e, a)
} }
if e, a := 14, Pop(f).(testFifoObject).val; a != e { if e, a := 14, Pop(context.Background(), f).(testFifoObject).val; a != e {
t.Fatalf("expected %d, got %d", e, a) t.Fatalf("expected %d, got %d", e, a)
} }
} }
@ -243,15 +244,15 @@ func TestFIFO_HasSynced(t *testing.T) {
{ {
actions: []func(f *FIFO){ actions: []func(f *FIFO){
func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
func(f *FIFO) { Pop(f) }, func(f *FIFO) { Pop(context.Background(), f) },
}, },
expectedSynced: false, expectedSynced: false,
}, },
{ {
actions: []func(f *FIFO){ actions: []func(f *FIFO){
func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, func(f *FIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
func(f *FIFO) { Pop(f) }, func(f *FIFO) { Pop(context.Background(), f) },
func(f *FIFO) { Pop(f) }, func(f *FIFO) { Pop(context.Background(), f) },
}, },
expectedSynced: true, expectedSynced: true,
}, },
@ -278,7 +279,7 @@ func TestFIFO_PopShouldUnblockWhenClosed(t *testing.T) {
const jobs = 10 const jobs = 10
for i := 0; i < jobs; i++ { for i := 0; i < jobs; i++ {
go func() { go func() {
f.Pop(func(obj interface{}, isInInitialList bool) error { f.Pop(context.Background(), func(obj interface{}, isInInitialList bool) error {
return nil return nil
}) })
c <- struct{}{} c <- struct{}{}

View File

@ -602,7 +602,7 @@ func TestReflectorListAndWatch(t *testing.T) {
// Verify we received the right objects with the right resource versions. // Verify we received the right objects with the right resource versions.
for _, expectedObj := range tc.expectedStore { for _, expectedObj := range tc.expectedStore {
storeObj := Pop(s).(metav1.Object) storeObj := Pop(context.Background(), s).(metav1.Object)
assert.Equal(t, expectedObj.GetName(), storeObj.GetName()) assert.Equal(t, expectedObj.GetName(), storeObj.GetName())
assert.Equal(t, expectedObj.GetResourceVersion(), storeObj.GetResourceVersion()) assert.Equal(t, expectedObj.GetResourceVersion(), storeObj.GetResourceVersion())
} }

View File

@ -17,6 +17,7 @@ limitations under the License.
package cache package cache
import ( import (
"context"
"fmt" "fmt"
"reflect" "reflect"
"runtime" "runtime"
@ -38,7 +39,7 @@ const closedFIFOName = "FIFO WAS CLOSED"
func popN(queue Queue, count int) []interface{} { func popN(queue Queue, count int) []interface{} {
result := []interface{}{} result := []interface{}{}
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
queue.Pop(func(obj interface{}, isInInitialList bool) error { queue.Pop(context.Background(), func(obj interface{}, isInInitialList bool) error {
result = append(result, obj) result = append(result, obj)
return nil return nil
}) })
@ -48,7 +49,7 @@ func popN(queue Queue, count int) []interface{} {
// helper function to reduce stuttering // helper function to reduce stuttering
func testRealFIFOPop(f *RealFIFO) testFifoObject { func testRealFIFOPop(f *RealFIFO) testFifoObject {
val := Pop(f) val := Pop(context.Background(), f)
if val == nil { if val == nil {
return testFifoObject{name: closedFIFOName} return testFifoObject{name: closedFIFOName}
} }
@ -404,7 +405,7 @@ func TestRealFIFO_transformer(t *testing.T) {
} }
for i := 0; i < len(expected1); i++ { for i := 0; i < len(expected1); i++ {
obj, err := f.Pop(func(o interface{}, isInInitialList bool) error { return nil }) obj, err := f.Pop(context.Background(), func(o interface{}, isInInitialList bool) error { return nil })
if err != nil { if err != nil {
t.Fatalf("got nothing on try %v?", i) t.Fatalf("got nothing on try %v?", i)
} }
@ -593,7 +594,7 @@ func TestRealFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -622,7 +623,7 @@ func TestRealFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -653,7 +654,7 @@ func TestRealFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -685,7 +686,7 @@ func TestRealFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for i, expected := range expectedList { for i, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("%d Expected %#v, got %#v", i, e, a) t.Errorf("%d Expected %#v, got %#v", i, e, a)
} }
@ -707,7 +708,7 @@ func TestRealFIFO_ReplaceMakesDeletions(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -738,7 +739,7 @@ func TestRealFIFO_ReplaceMakesDeletionsReplaced(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -764,7 +765,7 @@ func TestRealFIFO_UpdateResyncRace(t *testing.T) {
} }
for _, expected := range expectedList { for _, expected := range expectedList {
cur := Pop(f).(Deltas) cur := Pop(context.Background(), f).(Deltas)
if e, a := expected, cur; !reflect.DeepEqual(e, a) { if e, a := expected, cur; !reflect.DeepEqual(e, a) {
t.Errorf("Expected %#v, got %#v", e, a) t.Errorf("Expected %#v, got %#v", e, a)
} }
@ -900,15 +901,15 @@ func TestRealFIFO_HasSynced(t *testing.T) {
{ {
actions: []func(f *RealFIFO){ actions: []func(f *RealFIFO){
func(f *RealFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, func(f *RealFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
func(f *RealFIFO) { Pop(f) }, func(f *RealFIFO) { Pop(context.Background(), f) },
}, },
expectedSynced: false, expectedSynced: false,
}, },
{ {
actions: []func(f *RealFIFO){ actions: []func(f *RealFIFO){
func(f *RealFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") }, func(f *RealFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("b", 2)}, "0") },
func(f *RealFIFO) { Pop(f) }, func(f *RealFIFO) { Pop(context.Background(), f) },
func(f *RealFIFO) { Pop(f) }, func(f *RealFIFO) { Pop(context.Background(), f) },
}, },
expectedSynced: true, expectedSynced: true,
}, },
@ -917,9 +918,9 @@ func TestRealFIFO_HasSynced(t *testing.T) {
// there cannot be duplicate keys in the list or apiserver is broken. // there cannot be duplicate keys in the list or apiserver is broken.
actions: []func(f *RealFIFO){ actions: []func(f *RealFIFO){
func(f *RealFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("a", 2)}, "0") }, func(f *RealFIFO) { f.Replace([]interface{}{mkFifoObj("a", 1), mkFifoObj("a", 2)}, "0") },
func(f *RealFIFO) { Pop(f) }, func(f *RealFIFO) { Pop(context.Background(), f) },
// ATTENTION: difference with delta_fifo_test, every event is delivered, so a is listed twice and must be popped twice to remove both // ATTENTION: difference with delta_fifo_test, every event is delivered, so a is listed twice and must be popped twice to remove both
func(f *RealFIFO) { Pop(f) }, func(f *RealFIFO) { Pop(context.Background(), f) },
}, },
expectedSynced: true, expectedSynced: true,
}, },
@ -956,7 +957,7 @@ func TestRealFIFO_PopShouldUnblockWhenClosed(t *testing.T) {
const jobs = 10 const jobs = 10
for i := 0; i < jobs; i++ { for i := 0; i < jobs; i++ {
go func() { go func() {
f.Pop(func(obj interface{}, isInInitialList bool) error { f.Pop(context.Background(), func(obj interface{}, isInInitialList bool) error {
return nil return nil
}) })
c <- struct{}{} c <- struct{}{}